# quadgk

Numerically evaluate integral — Gauss-Kronrod quadrature

## Description

`[___] = quadgk(`

specifies additional options with one or more name-value pair arguments using either of the
previous output argument combinations. For example, specify `fun`

,`a`

,`b`

,`Name,Value`

)`'Waypoints'`

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

## Examples

## Input Arguments

## Output Arguments

## Tips

`quadgk`

and`integral`

use essentially the same integration method. You should generally use`integral`

rather than`quadgk`

. However, you can use`quadgk`

to:Monitor solution accuracy with the

`errbnd`

output argument.Specify a large value for

`MaxIntervalCount`

when`integral`

warns about reaching the maximum number of intervals.

`quadgk`

can integrate functions that are singular at finite endpoints if the singularities are not too strong. For example, it can integrate functions that behave at an endpoint`c`

like`log|x-c|`

or`|x-c|`

for^{p}`p >= -1/2`

. If the function is singular at points inside the integration limits`[a b]`

, then write the integral as a sum of integrals over subintervals with the singular points as endpoints, compute them with`quadgk`

, and add the results.If the interval is infinite, $$\left[a,\infty \right)$$, then for the integral of

`fun(x)`

to exist,`fun(x)`

must decay as`x`

approaches infinity, and`quadgk`

requires it to decay rapidly.

## References

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

## Extended Capabilities

**Introduced in R2007b**