triplequad

Numerical triple integral over a box (older interface).

Category: Mathematics > Numerical Integration and Differential Equations

Syntax

q = triplequad(fun, xmin, xmax, ymin, ymax, zmin, zmax)

Integrates fun(x, y, z) over the box.

q = triplequad(___, tol)

Uses the absolute tolerance tol.

Description

triplequad nests adaptive one-dimensional integrals. It is kept for compatibility, and integral3 is the recommended replacement, which also accepts variable limits.

Use element-wise operators in the integrand.

Input arguments

fun
Handle accepting a vector x and scalars y, z, returning a vector.
xmin ... zmax
Finite limits of the box.
tol
Absolute tolerance. Default 1e-6.

Output arguments

q
Approximate value of the integral.

Example

Integral of x + y + z on the unit cube

triplequad(@(x, y, z) x + y + z, 0, 1, 0, 1, 0, 1)
Output
ans = 1.5000

See also

integral3 dblquad integral2