Computes integral of vector functions using Romberg quadrature.
Updated 1 Mar 2016

View License

% [x, err] = rombergQuadrature(fun,tSpan,tol)
% Compute the integral(fun), over the domain tSpan, to an accuracy of tol,
% using Romberg quadrature. Fully vectorized.
% Good for high-accuracy quadrature over smooth vector functions.
% If necessary, this function will automatically sub-divide the interval to
% achieve the desired accuracy. This should only occur when fun is stiff or
% non-smooth.
% fun = vector function to be integrated
% dx = fun(t)
% t = [1, nt] = time vector
% dx = [nx, nt] = function value at each point in t
% tSpan = [tLow, tUpp] = time span (domain) for integration
% tol = [nx,1] = desired error tolerance along each dimension
% x = [nx,1] = integral along each dimension
% err = [nx, 1] = error estimate along each dimension
% algorithm from:

Cite As

Matthew Kelly (2024). rombergQuadrature (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Numerical Integration and Differential Equations in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Now the rombergQuadrature automatically detects a non-smooth integrand and sub-divides the interval to achieve the desired accuracy.