Updated 13 Dec 2015
% x = simpsonQuadrature(fun,tLow,tUpp,n)
% This function uses simpson quadrature over each of n uniform segments to
% approximate the integral of fun(t) on the interval tLow <= t <= tUpp
% fun = function handle
% f = fun(t)
% t = [1, nt] = time query points on [a,b]
% f = [nx, nt] = vector function at query points
% tLow = scalar lower bound on time
% tUpp = scalar upper bound on time
% n = number of segments to divide interval into
% x = [nx, 1] = integral along each dimension
Matthew Kelly (2023). simpsonQuadrature (https://www.mathworks.com/matlabcentral/fileexchange/54457-simpsonquadrature), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: Simpson's rule for numerical integration, Simpson's Rule Integration
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.