Numerical integration
Theintegral
function attempts to satisfy:
abs(q - Q) <= max(AbsTol,RelTol*abs(q))
q
is the computed value of the integral andQ
is the (unknown) exact value. The absolute and relative tolerances provide a way of trading off accuracy and computation time. Usually, the relative tolerance determines the accuracy of the integration. However ifabs(q)
is sufficiently small, the absolute tolerance determines the accuracy of the integration. You should generally specify both absolute and relative tolerances together.If you are specifying single-precision limits of integration, or iffun
returns single-precision results, you might need to specify larger absolute and relative error tolerances.
[1] L.F. Shampine “Vectorized Adaptive Quadrature in MATLAB®,”Journal of Computational and Applied Mathematics, 211, 2008, pp.131–140.