I'm collecting accelerometer data and interested in extracting frequencies from 1-10 Hz. I'm aware of how to do the FFT but not sure how to extract these frequencies 1Hz, 3Hz and 10Hz. Any pointers?
Asked
Active
Viewed 2,175 times
1
-
1how is the result of your FFT represented? – al-Hwarizmi Jul 23 '13 at 11:57
-
To begin with, how is the accelerometer data represented? – 40 votes Jul 23 '13 at 18:27
-
Accelerometer data is 3 double values in x,y,z. I get the magnitude and work on it. k=fft(mag(x,y,z)). Then I do s=mag(k). s is an array of double values. – M-T-A Jul 24 '13 at 08:12
1 Answers
4
Just take the inner product of your data with a complex exponential at the frequency of interest. If $g$ is your data, then just substitute for $f$ the value of the frequency you want (e.g., 1, 3, 10, ...):
$$ \int_{-\infty}^{+\infty} g(t) e^{ -j2\pi f t } dt $$
Or if discrete:
$$ \sum_{n=0}^{N-1} g[n] e^{-j2\pi n \frac{f}{f_s} }, $$
where $f_s$ is the sampling frequency and $N$ is the number of samples you have.
The DFT (which is what the FFT calculates) implements the above but only over a subset of the frequencies. You could also interpolate the output of the FFT, but it's unnecessary and probably easier to just calculate it directly.
AnonSubmitter85
- 3,455