integral3
Numerically evaluate triple integral
Syntax
Description
Examples
Input Arguments
Tips
The
integral3
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 any or all of the limits:
ymin
,ymax
,zmin
,zmax
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 when any or all of the limits:ymin(x)
,ymax(x)
,zmin(x,y)
,zmax(x,y)
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,z) x + y + z + 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 may need to specify larger absolute and relative error tolerances.To solve 4-D and higher order integrals, you can nest calls to
integral
,integral2
, andintegral3
. Another option is to use theintegralN
function on the MATLAB® File Exchange, which solves integrals of orders 4 - 6.
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