MATLAB Function Reference |
Numerically evaluate integral, adaptive Lobatto quadrature
Syntax
q = quadl(fun,a,b) q = quadl(fun,a,b,tol) q = quadl(fun,a,b,tol,trace) [q,fcnt] = quadl(fun,a,b,...)
Description
q = quadl(fun,a,b)
approximates the integral of function fun
from a
to b
, to within an error of 10-6 using recursive adaptive Lobatto quadrature. fun
is a function handle. See Function Handles in the MATLAB Programming documentation for more information. fun
accepts a vector x
and returns a vector y
, the function fun
evaluated at each element of x
.
Parameterizing Functions Called by Function Functions, in the MATLAB mathematics documentation, explains how to provide additional parameters to the function fun
, if necessary.
q = quadl(fun,a,b,tol)
uses an absolute error tolerance of tol
instead of the default, which is 1.0e-6
. Larger values of tol
result in fewer function evaluations and faster computation, but less accurate results.
quadl(fun,a,b,tol,trace)
with non-zero trace
shows the values of [fcnt a b-a q]
during the recursion.
[q,fcnt] = quadl(...)
returns the number of function evaluations.
Use array operators .*
, ./
and .^
in the definition of fun
so that it can be evaluated with a vector argument.
The function quad
may be more efficient with low accuracies or nonsmooth integrands.
Examples
Pass M-file function handle @myfun
to quadl
:
Pass anonymous function handle F
to quadl
:
Algorithm
quadl
implements a high order method using an adaptive Gauss/Lobatto quadrature rule.
Diagnostics
quadl
may issue one of the following warnings:
'Minimum step size reached'
indicates that the recursive interval subdivision has produced a subinterval whose length is on the order of roundoff error in the length of the original interval. A nonintegrable singularity is possible.
'Maximum function count exceeded'
indicates that the integrand has been evaluated more than 10,000 times. A nonintegrable singularity is likely.
'Infinite or Not-a-Number function value encountered'
indicates a floating point overflow or division by zero during the evaluation of the integrand in the interior of the interval.
See Also
dblquad
, quad
, triplequad
, function_handle
(@
), anonymous functions
References
[1] Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at http:// www.inf.ethz.ch/personal/gander.
quad, quad8 | quadv |
© 1994-2005 The MathWorks, Inc.