FUNCTION REFERENCE

quadgk

Numerical integration by adaptive Gauss-Kronrod quadrature.

Numerical integration by adaptive Gauss-Kronrod quadrature.

Syntax

q = quadgk(fun, a, b)

Syntax

q = quadgk(fun, a, b, 'Name', value, ...)

Syntax

[q, errbnd] = quadgk(...)

fun is a function handle called with a row of points; it must return a row of the same size. a and b may be infinite, and fun may have integrable singularities at the ends. Options: 'AbsTol' (default 1e-10), 'RelTol' (default 1e-6), 'Waypoints' and 'MaxIntervalCount' (default 650). errbnd is an approximate bound on the absolute error.

Example

quadgk(@(x) exp(-x.^2), -Inf, Inf)   % 1.7725

Example

[q, err] = quadgk(@(x) 1 ./ sqrt(x), 0, 1)   % q = 2.0000, err = 2.5601e-13

Differences from MATLAB: Complex limits and waypoints (contour integration) are not supported yet.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.