Post by TideManI have experimental acceleration data, A, and a corresponding time vector, t. I would like to integrate this data so I can obtain a position vs time graph.
How do I go about integrating this data without having a function? Is it correct to use cumtrapz?
i.e. will cumtrapz(t,A) provide me with velocity data?
You need to high-pass filter to remove spurious low-frequency noise
from your signal, otherwise it gets amplified and will dominate the
result. Dealing with this is much more important than worrying about
whether you should use cumtrapz or whatever. In fact, I just use
cumsum.
I've found that orthogonal wavelet decomposition is the best high-pass
filter (if you have the wavelet toolbox), but there are others, like
Butterworth.
We are mainly concerned with low frequencies, so we have a buttersworth low-pass filter with a cutoff frequency of 100Hz. This cuts out quite a bit of the noise.
Our time data is equally spaced with each point being 0.0001 seconds after the last one. We have 30,000 data points (acceleration) at a sampling frequency of 10kHz, so we have 3 seconds of data.
Using trapz provides us with only one number, I don't really understand that. Using cumtrapz provides us with position, however the output isn't what we expected so it's hard for us to understand if the cumtrapz output is accurate.
You've got it arse about face.
For integration, you need to high-pass filter.
Consider y=cos(wt)
it integrates to 1/w sin(wt)
and integrates again to -1/w^2 cos(wt)
which is -y/w^2
So, if w is small, the acceleration gets scaled up by much more than
if w is large.
Therefore, any low frequency noise in the signal gets amplified.
This results in the displacement derived from double integration of
the acceleration wandering all over the place and perhaps heading off
to + or - infinity.
Perhaps this is why "the output isn't what we expected".
IMHO it has nothing to do with cumtrapz, which works fine, just as
cumsum would.