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.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Numerical integration

`q = integral(fun,xmin,xmax)`

`q = integral(fun,xmin,xmax,Name,Value)`

`q = integral(`

specifies
additional options with one or more `fun`

,`xmin`

,`xmax`

,`Name,Value`

)`Name,Value`

pair
arguments. For example, specify `'WayPoints'`

followed
by a vector of real or complex numbers to indicate specific points
for the integrator to use.

Do not use waypoints to specify singularities. Instead, split the interval and add the results of separate integrations with the singularities at the endpoints.

The

`integral`

function attempts to satisfy:whereabs(q - Q) <= max(AbsTol,RelTol*abs(q))

`q`

is the computed value of the integral and`Q`

is the (unknown) exact value. The absolute and relative tolerances provide a way of trading off accuracy and computation time. Usually, the relative tolerance determines the accuracy of the integration. However if`abs(q)`

is sufficiently small, the absolute tolerance determines the accuracy of the integration. You should generally specify both absolute and relative tolerances together.If you specify a complex value for

`xmin`

,`xmax`

, or any waypoint, all of your limits and waypoints must be finite.If you are specifying single-precision limits of integration, or if

`fun`

returns single-precision results, you might need to specify larger absolute and relative error tolerances.

[1] L.F. Shampine “Vectorized
Adaptive Quadrature in MATLAB^{®},” Journal
of Computational and Applied Mathematics, 211, 2008, pp.131–140.

Was this topic helpful?