Introduction
Suppose I have N points x(1:N) at which I have function values f(1:N), for example:
x = [ 0.0795, 0.1327, 0.1395, 0.5133, 0.6470, 0.7358, 0.7640 ];
f = [ 0.0388, 0.4774, 0.4547, 0.0784, 0.3241, 0.2818, 0.9667 ];
I want to calculate the cumulative integral of f with respect to x using these data.
Low-Order Solution
In MATLAB, I can do this easily using cumtrapz():
>> result = cumtrapz( x, f )
result =
0 0.0137 0.0169 0.1165 0.1434 0.1703 0.1879
Problem
Unfortunately, cumtrapz() uses the trapezoidal method for numerical integration, which is insufficient for my purposes.
Higher-order methods exist, like Simpson's Rule, but to my knowledge there isn't a function that performs the cumulative version of Simpson's Rule for nonuniform grids at the MATLAB File Exchange, or anywhere else.
Does a higher-order version of cumtrapz() already exist? If not, what would I have to do to implement it myself?
