1
$\begingroup$

I am not from electrical eng. or physics background, so a layman explanation would be appreciated. I work with sensor data (accelerometer) from wearable device, collected for few hours.

I take few samples from it, and prepared a fixed sized samples of 100-time steps. This is the acceleration (actually 1 dim) magnitude over time (100 seconds).

Then I would like to obtain the FFT of the instances. I used Python's scipy libary to transform this to frequency domain,

from scipy.fft import fft
import numpy as np

fft_values = fft(data)
magnitude = np.abs(fft_values)

So for each instance of N=100 I obtained 100 frequency components, since I am taking the absolute values of the FFT.

The result is what I plot in this figure, showing instance in time and frequency domains.

enter image description here

However, I a separate question, someone commented that I should only consider the real components of the FFT in this case, since I am dealing acceleration not signal. I cannot reach out the commenter for details.

From what I understand, he was suggesting that I get 50 FFT values for each sample sized 100.

Can someone explains this further please?

$\endgroup$

1 Answer 1

3
$\begingroup$

Your sample frequency is $f_s = 1\,{\rm Hz}$, and you take $N=100$ samples.

Then, the discrete Fourier transform (DFT, or FFT) will return $N$ frequency samples corresponding to frequencies $0, f_s/N, 2f_s/N, \cdots, (N-1)f_s/N$. This means, you get a frequency sample every 0.01 Hz. Your frequency plot label is wrong in this sense, it's not Hz, but centi-Hz.

The frequency plot (for real signals) will be symmetric around 0 Hz, and the result of the FFT is usually plotted as you show above, with the second half of the N frequency samples first, followed by the first half, leaving 0 Hz in the middle. The maximum effective frequency you can analyze is 0.5 Hz ($f_s/2$); if this doesn't seem familiar, read about The Sampling Theorem.

It is OK to take the magnitude of the complex numbers returned, since you are not interested in the phase. Do not take the real values.

$\endgroup$
1
  • $\begingroup$ I see. So in the above plot, the second half should have come first. $\endgroup$
    – Amina Umar
    Mar 29 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.