MATLAB: Numerical integration: quadgk vs integral

MATLABnumerical integration

Hello: I have not been able to find out what is the underlying quadrature formula in Matlab's builtin function integral. I think that quad uses Simpson, quadl a Gauss-Lobato formula and quadgk the Gauss-Kronrod formula G7K15, and all of them use some kind of adaptative scheme. What does integral(f,a,b) do with my poor function f? When should I use integral and when quadgk? Thank you, Mariano

Best Answer

Dear Mariano,
The Mathlab function 'integral(fun,xmin,xmax)' numerically integrates function fun from xmin to xmax using global adaptive quadrature and default error tolerances.
In the documention of this function (doc integral), this ref can be found:
% Portions based on "quadva" by Lawrence F. Shampine.
% Ref: L.F. Shampine, "Vectorized Adaptive Quadrature in Matlab",
% Journal of Computational and Applied Mathematics 211, 2008, pp.131-140
In the Documentation of quadgk you can find a list of multiple quadrature functions that can be used whith there (dis)advantages.
Kind regards, Christiaan