MATLAB Double Integral
To evaluate integrals of the form
MATLAB provides a function dblquad. The calling syntax for dblquad is
I=dblquad (‘fxy-fun’,xmin,xmax,ymin,ymax,tol,@method)
where tol and method are optional input arguments. The optional argument tol specified tolerance (default value is 10-6), as previously discussed for 1-D integration, and method determines a choice that the user makes about the purpose of integration to be used, e.g., quad and quad1. The default method is quad. The user-defined integrand function fxy-fun,must be written that it can accept a vector x and a scalar y while evaluating the integrand.
Example
Let us compute the following integral
It is merely to verify analytically that I=4. Let us see how dblquad execute on this integral.
Note1: x is a vector argument. Next, run dblquad with default tol and method.
Note2: We get the exact result with default tolerance and the default lower-order method, quad. We can verify that the higher-order method quad1 gives the same result by executing the command.
I=dblquad (F,0,2,-1,1,[ ],@quad1)