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
Name-Value Arguments
Output Arguments
Tips
quadgkandintegraluse essentially the same integration method. You should generally useintegralrather thanquadgk. However, you can usequadgkto:Monitor solution accuracy with the
errbndoutput argument.Specify a large value for
MaxIntervalCountwhenintegralwarns about reaching the maximum number of intervals.
quadgkcan 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 endpointclikelog|x-c|or|x-c|pforp >= -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 asxapproaches infinity, andquadgkrequires 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