integral2
Numerically evaluate double integral
Description
Examples
Input Arguments
Tips
The
integral2
function attempts to satisfy:whereabs(q - Q) <= max(AbsTol,RelTol*abs(q))
q
is the computed value of the integral andQ
is the (unknown) exact value. The absolute and relative tolerances provide a way of trading off accuracy and computation time. Usually, the relative tolerance determines the accuracy of the integration. However ifabs(q)
is sufficiently small, the absolute tolerance determines the accuracy of the integration. You should generally specify both absolute and relative tolerances together.The
'iterated'
method can be more effective when your function has discontinuities within the integration region. However, the best performance and accuracy occurs when you split the integral at the points of discontinuity and sum the results of multiple integrations.When integrating over nonrectangular regions, the best performance and accuracy occurs when
ymin
,ymax
, (or both) are function handles. Avoid setting integrand function values to zero to integrate over a nonrectangular region. If you must do this, specify'iterated'
method.Use the
'iterated'
method whenymin
,ymax
, (or both) are unbounded functions.When parameterizing anonymous functions, be aware that parameter values persist for the life of the function handle. For example, the function
fun = @(x,y) x + y + a
uses the value ofa
at the timefun
was created. If you later decide to change the value ofa
, you must redefine the anonymous function with the new value.If you are specifying single-precision limits of integration, or if
fun
returns single-precision results, you might need to specify larger absolute and relative error tolerances.
References
[1] L.F. Shampine “Vectorized Adaptive Quadrature in MATLAB®,” Journal of Computational and Applied Mathematics, 211, 2008, pp.131–140.
[2] L.F. Shampine, "MATLAB Program for Quadrature in 2D." Applied Mathematics and Computation. Vol. 202, Issue 1, 2008, pp. 266–274.
Extended Capabilities
Version History
Introduced in R2012a