Numerical double integration
Syntax
result = dblquad('fun',inmin,inmax,outmin,outmax)
result = dblquad('fun',inmin,inmax,outmin,outmax,tol,trace)
result = dblquad('fun',inmin,inmax,outmin,outmax,tol,trace,order)
Description
result = dblquad('fun',inmin,inmax,outmin,outmax)
evaluates the double integral fun(inner,outer) using the quad quadrature function. inner is the inner variable, ranging from inmin to inmax, and outer is the outer variable, ranging from outmin to outmax. The first argument 'fun' is a string representing the integrand function. This function must be a function of two variables of the form fout = fun(inner,outer). The function must take a vector inner and a scalar outer and return a vector fout that is the function evaluated at outer and each value of inner.
result = dblquad('fun',inmin,inmax,outmin,outmax,tol,trace)
passes tol and trace to the quad function. See the help entry for quad for a description of the tol and trace parameters.
result = dblquad('fun',inmin,inmax,outmin,outmax,tol,trace,order)
passes tol and trace to the quad or quad8 function depending on the value of the string order. Valid values for order are 'quad' and 'quad8' or the name of any user-defined quadrature method with the same calling and return arguments as quad and quad8.
Example
result = dblquad('integrnd',pi,2*pi,0,pi) integrates the function y*sin(x)+x*cos(y), where x ranges from
to 2
, and y ranges from 0 to
, assuming:
function out = integrnd(x, y)
out = y*sin(x)+x*cos(y);
Note that integrnd.m is valid when x is a vector and y is a scalar. Also, x must be the first argument to integrnd.m since it is the inner variable.
See Also
quad, quad8 Numerical evaluation of integrals
[ Previous | Help Desk | Next ]