Integrating non uniform grid data from an accelerometer Is there a better method than the trapezoidal rule as outlined here?
P.S. not familiar with the site, sorry if this has the wrong tag.
 A: I'd have to understand the nature of the data and how you expect that data to behave, but in principle, you could use a modified Simpson's Rule.  The difference here is that you have to perform a quadratic interpolation for every triplet of points.  That is, given a triplet of data $(x_{2 i-1},y_{2 i-1}), (x_{2 i},y_{2 i}), (x_{2  i+1},y_{2 i+1})$, where $i \in \{1,2,\ldots,N/2\}$ and $N$ is the number of data points, set
$$f_i(x) = a_i + b_i (x-x_{2 i}) + c_i (x-x_{2 i})^2$$
Plug in the triplet of data and solve for $a_i$, $b_i$, and $c_i$.  Then integrate the resulting expression for $f_i(x)$ over $[x_{2 i-1},x_{2 i+1}]$:
$$\int_{x_{2 i-1}}^{x_{2 i+1}} dx \: f_i(x) = \frac{x_{2 i-1}-x_{2 i+1}}{6
   (x_{2 i}-x_{2 i-1}) (x_{2 i}-x_{2 i+1})}   
\left[\left (-3 x_{2 i}^2 (y_{2 i-1}+y_{2 i+1})-2 x_{2 i-1}
   (x_{2 i+1} (y_{2 i}+y_{2 i-1}+y_{2 i+1})-x_{2 i} (y_{2 i-1}+2 y_{2 i+1}))\right) \\ \left (+2 x_{2 i} x_{2 i+1} (2 y_{2 i-1}+y_{2 i+1})+x_{2 i-1}^2
   (y_{2 i}-y_{2 i+1})+x_{2 i+1}^2 (y_{2 i}-y_{2 i-1})\right)\right]$$
This is for one triplet; you will run this over all (nonoverlapping) triplets of data to get your integral. No doubt that this is more complicated and expensive to use than the trapezoidal expression, but if your data represent a piecewise smooth function, this representation should be more accurate.
