MATLAB: Is there a function in Matlab that is similar to “cumtrapz” but uses a more accurate method of array integration (such as Simpson’s rule)

array integrationcummulative integration

Is there a function in Matlab that is similar to "cumtrapz" but uses a more accurate method of array integration (such as Simpson's rule)? (i.e., to integrate a nonanalytic function (represented by an array))

Best Answer

You COULD use a spline interpolant, then integrating the spline. That would be a higher order integration. (Pchip MAY be a better choice than spline, although spline will be theoretically a higher order as an integration tool here.)
Or you could use a Simpsons rule. Note that it is easy to think you are doing a better job, because the integration rule is of a "higher" polynomial order. In fact, it is trivial to give you a set of points that will cause a simple high order integration to fail miserably.