| MATLAB Function Reference | ![]() |
Numerically evaluate double integral
Syntax
q = dblquad(fun,xmin,xmax,ymin,ymax) q = dblquad(fun,xmin,xmax,ymin,ymax,tol) q = dblquad(fun,xmin,xmax,ymin,ymax,tol,method)
Description
q = dblquad(fun,xmin,xmax,ymin,ymax)
calls the quad function to evaluate the double integral fun(x,y) over the rectangle xmin <= x <= xmax, ymin <= y <= ymax. fun is a function handle. See Function Handles in the MATLAB Programming documentation for more information. fun(x,y) must accept a vector x and a scalar y and return a vector of values of the integrand.
Parameterizing Functions Called by Function Functions, in the MATLAB mathematics documentation, explains how to provide additional parameters to the function fun, if necessary.
q = dblquad(fun,xmin,xmax,ymin,ymax,tol)
uses a tolerance tol instead of the default, which is 1.0e-6.
q = dblquad(fun,xmin,xmax,ymin,ymax,tol,method)
uses the quadrature function specified as method, instead of the default quad. Valid values for method are @quadl or the function handle of a user-defined quadrature method that has the same calling sequence as quad and quadl.
Example
Pass M-file function handle @integrnd to dblquad:
where the M-file integrnd.m is
Pass anonymous function handle F to dblquad:
The integrnd function integrates y*sin(x)+x*cos(y) over the square pi <= x <= 2*pi, 0 <= y <= pi. Note that the integrand can be evaluated with a vector x and a scalar y.
Nonsquare regions can be handled by setting the integrand to zero outside of the region. For example, the volume of a hemisphere is
See Also
quad, quadl, triplequad, function_handle (@), anonymous functions
| dbdown | dbmex | ![]() |
© 1994-2005 The MathWorks, Inc.