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
andintegral
use essentially the same integration method. You should generally useintegral
rather thanquadgk
. However, you can usequadgk
to:Monitor solution accuracy with the
errbnd
output argument.Specify a large value for
MaxIntervalCount
whenintegral
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 endpointc
likelog|x-c|
or|x-c|p
forp >= -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 withquadgk
, and add the results.If the interval is infinite, , then for the integral of
fun(x)
to exist,fun(x)
must decay asx
approaches infinity, andquadgk
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
Version History
Introduced in R2007b