quadl

Numerical integral by adaptive Lobatto quadrature (older interface).

Category: Mathematics > Numerical Integration and Differential Equations

Syntax

q = quadl(fun, a, b)

Integrates fun from a to b.

q = quadl(fun, a, b, tol)

Uses the absolute tolerance tol.

Description

quadl applies a Gauss-Lobatto rule with adaptive subdivision. For smooth integrands and strict tolerances it is generally more efficient than quad, which uses the lower-order Simpson rule.

It is retained for compatibility; integral is the current recommendation.

Input arguments

fun
Handle accepting a vector x and returning a vector.
a, b
Finite limits.
tol
Absolute tolerance. Default 1e-6.

Output arguments

q
Approximate value of the integral.

Example

A smooth integrand

q = quadl(@(x) sin(x), 0, pi);
fprintf('%.6f\n', q)
Output
2.000000

See also

integral quad quadgk trapz