This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


(Not recommended) Numerically evaluate triple integral

triplequad is not recommended. Use integral3 instead.


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


q = triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax) evaluates the triple integral fun(x,y,z) over the three dimensional rectangular region xmin <= x <= xmax, ymin <= y <= ymax, zmin <= z <= zmax. The first input, fun, is a function handle. fun(x,y,z) must accept a vector x and scalars y and z, and return a vector of values of the integrand.

Parameterizing Functions explains how to provide additional parameters to the function fun, if necessary.

q = triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax,tol) uses a tolerance tol instead of the default, which is 1.0e-6.

q = triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax,tol,method) uses the quadrature function specified as method, instead of the default quad. Valid values for method are @quadl or the function handle of a user-defined quadrature method that has the same calling sequence as quad and quadl.


Pass function handle @integrnd to triplequad:P

Q = triplequad(@integrnd,0,pi,0,1,-1,1);

where the file integrnd.m is

function f = integrnd(x,y,z)
f = y*sin(x)+z*cos(x);

Pass anonymous function handle F to triplequad:

F = @(x,y,z)y*sin(x)+z*cos(x);
Q = triplequad(F,0,pi,0,1,-1,1);

This example integrates y*sin(x)+z*cos(x) over the region 0 <= x <= pi, 0 <= y <= 1, -1 <= z <= 1. Note that the integrand can be evaluated with a vector x and scalars y and z.

Introduced before R2006a

Was this topic helpful?