integral3
Numerical triple integral over a box or a region with variable limits.
Category: Mathematics > Numerical Integration and Differential Equations
Syntax
q = integral3(fun, xmin, xmax, ymin, ymax, zmin, zmax)
Integrates fun(x, y, z) over a box.
q = integral3(___, Name, Value)
Sets options such as 'AbsTol', 'RelTol' and 'Method'.
Description
The method is the three-dimensional analogue of integral2, based on nested adaptive quadrature. The cost grows quickly with the dimension, so smooth integrands and moderate tolerances are advisable.
Use element-wise operators in the integrand.
Input arguments
fun- Handle
w = fun(x, y, z)that accepts arrays of the same size and returns an array of that size. xmin ... zmax- Scalar limits; the
ylimits may be handles ofx, and thezlimits handles ofxandy.
Output arguments
q- Approximate value of the integral.
Example
Integral of x + y + z on the unit cube
integral3(@(x, y, z) x + y + z, 0, 1, 0, 1, 0, 1)
Output
ans = 1.5000