MATLAB Function Reference Previous page   Next Page
quadv

Vectorized quadrature

Syntax

Description

Q = quadv(fun,a,b) approximates the integral of the complex array-valued function fun from a to b to within an error of 1.e-6 using recursive adaptive Simpson quadrature. fun is a function handle. See Function Handles in the MATLAB Programming documentation for more information. The function Y = fun(x) should accept a scalar argument x and return an array result Y, whose components are the integrands evaluated at x.

Parameterizing Functions Called by Function Functions, in the MATLAB Mathematics documentation, explains how to provide addition parameters to the function fun, if necessary.

Q = quadv(fun,a,b,tol) uses the absolute error tolerance tol for all the integrals instead of the default, which is 1.e-6.

Q = quadv(fun,a,b,tol,trace) with non-zero trace shows the values of [fcnt a b-a Q(1)] during the recursion.

[Q,fcnt] = quadv(...) returns the number of function evaluations.

Example

For the parameterized array-valued function myarrayfun, defined by

the following command integrates myarrayfun, for the parameter value n = 10 between a = 0 and b = 1:

The resulting array Qv has 10 elements estimating Q(k) = log((k+1)./(k)), for k = 1:10.

The entries in Qv are slightly different than if you compute the integrals using quad in a loop:

where myscalarfun is:

See Also

quad, quadl, dblquad, triplequad, function_handle (@)


Previous page  quadl questdlg Next page

© 1994-2005 The MathWorks, Inc.