0
$\begingroup$

I am working on an implementation in which I need to apply an FFT to determine which of 4 frequencies are present in a signal.

I am doing a 64 point FFT on a buffer which only is partly filled (the remainder of the buffer is zero-ed).

When looking at the screenshots of the signal in the time domain, you will notice that the signal is roughly the same in each screenshot, but it has different phase in each screenshot.

signal in time domain - first screenshot

signal in time domain - second screenshot

When looking at the screenshots of the FFT of the two versions of the signal, you will notice that the magnitude for bin 4, which corresponds to the signal frequency, is 874.83 in one of the screenshots but 366.94 in the other, even though the only difference between the two versions of the signal is a phase difference (?)

FFT of signal in first screenshot

FFT of signal in second screenshot

I don't understands why this happens and how to deal with this. I am generating the signal myself and want to make sure that phase doesn't play a role here. When the signals are more or less the same in amplitude, I would expect their magnitude after calculating the FFT to stay the same.

In case you need this information, the sampling frequency is 7800 Hz and the actual frequency involved is 487.5 Hz which is exactly 7800/64*4, or the start of bin 4.

In the screenshots of the FFT, the magnitude data is plotted upside down (i.e. zero is the top of the screenshot).

Can anyone please shed some light on this? Thanks for helping! B

$\endgroup$

1 Answer 1

3
$\begingroup$

The FFT magnitude, for non-zero sinusoidal-like signals, will only be the same, given a change in phase relative to the window, for signals that are exactly periodic in the window width (the non-zero padded portion of the FFT aperture).

$\endgroup$
2
  • $\begingroup$ Thanks. Do you mean that the signal frequency has to be chosen such that the window width is an exact multiple of the signal period? $\endgroup$
    – b20000
    Jan 9, 2014 at 6:28
  • $\begingroup$ Yes. If the window width is not an exact multiple of the signal period you will get "spectral leakage", which is probably what is going on in your case. Applying a hann window, or similar window function, before the fft can help to reduce the effects of spectral leakage. $\endgroup$
    – Daniel K
    Dec 15, 2016 at 3:07

Your Answer

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

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