quad2d
Numerical double integral using tiled adaptive Gauss-Kronrod quadrature.
Category: Mathematics > Numerical Integration and Differential Equations
Syntax
q = quad2d(fun, xmin, xmax, ymin, ymax)
Integrates fun(x, y) over a region; the y limits may be function handles of x.
q = quad2d(___, Name, Value)
Sets options such as 'AbsTol' and 'RelTol'.
Description
The region is split into subregions, and each is integrated with a Gauss-Kronrod rule; the subregions with the largest error are split again. This performs well for smooth integrands and for regions with curved boundaries.
For most work, integral2 is the recommended interface; quad2d remains for compatibility and for integrands with singularities at the boundary.
Input arguments
fun- Handle
z = fun(x, y)accepting arrays of the same size. xmin ... ymax- Limits of the region.
Output arguments
q- Approximate value of the integral.
Example
Integral of x*y on the unit square
quad2d(@(x, y) x.*y, 0, 1, 0, 1)
Output
ans = 0.2500