2
$\begingroup$

I have a variable in time and I calculated its mean which is 9.5. I have done the Fourier Transform of this variable, using the FFT in matlab. I would like to consider only a range of frequencies, so I substituted with zero all the frequencies that I have excluded. After this I did the ifft of this, obtaining again a variable in time. I calculated its mean and now is 9.5. I am surprised because I supposed that it should have been a lower value because the signal does not include some frequencies.

Maybe substituting with 0 the value in the frequencies that I don't want to include is not the right procedure. Can you help me?

$\endgroup$
1
  • 3
    $\begingroup$ Don't zero out FFT bins to filter. You can convolve the signal with a sine wave and it's equivalent to multiplication a delta function in the frequency domain. $\endgroup$
    – ZR Han
    Commented Jul 21, 2021 at 9:36

1 Answer 1

3
$\begingroup$

[Pictures to follow] Let us start with a thought experiment (which can be simulated): imagine a constant signal with value $c$. Add a full period of a pure sine with non-zero frequency. If you can remove this harmonic contribution by zeroing out its frequency bin in the Fourier domain, then the resulting inverse Fourier signal will still have mean $c$. So remove "some frequency" does not reduce the mean per se.

Now remember that, in the Fourier domain, the "O-th" frequency ought to be equal (up to a constant scale factor) to the average of the signal. This is consistent with the above. The pure sine period has equally distributed values above and below $0$, so this does not contribute to the signal's average.

Then, imagine that the observation time frame only encloses the first positive half of the "one-period sine", or the second one. Zeroing its frequency will sure remove frequency components, yet parts of the "not-otherwise" compensated sine bumps may remain, and modify the amplitude, both ways. Therefore, if everything has been done right, your experiment is not totally surprising.

Finally: if removing or cancelling frequency terms in an FFT was a generic cure (panacea), I would not have the my job, and this site would be leaner. As suggested by @ZRHan, to zero out FFT coefficients is quite dangerous.

$\endgroup$

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.