Scaling of fft output?

54 vues (au cours des 30 derniers jours)
Chelsea
Chelsea le 24 Mai 2012
Commenté : Kenny le 14 Fév 2018
I'm noticing that in the fft examples in the MATLAB help files, sometimes the output of the fft function is divided by the length of the original time-domain signal before it's plotted, say, as power against frequency. What does that scaling accomplish? Is it necessary for all fft applications, or if not, what determines whether or not you need it? I'm trying to understand exactly what I'm looking at when I plot a frequency spectrum using that code. Thanks!

Réponses (2)

Honglei Chen
Honglei Chen le 24 Mai 2012
  4 commentaires
Dr. Seis
Dr. Seis le 25 Mai 2012
I am not talking about power... I am talking about the correct scaling factor for the result of the FFT. I use Parseval's theorem, which compares the ENERGY (not power) of a signal in the time domain to the ENERGY of the signal in the frequency domain. See my answer in the other post. You compute the energy in the time domain by squaring the amplitudes and integrating over the time interval... or simply:
dt=1/Fs;
sum(y.^2)*dt
In the frequency domain you square the magnitude of the amplitudes and integrate over the frequency interval... or simply:
df = Fs/N;
sum(abs(fft(y)*dt).^2)*df
If the amplitudes are scaled correctly, the ENERGY should be the exact same for both cases.
Dr. Seis
Dr. Seis le 25 Mai 2012
Also, the Fourier transform is an integral. The FFT is basically performing a discrete version of the integral, but it is assuming a discrete sampling frequency of 1 when it does this (at zero frequency it is simply the sum of the amplitudes in the time domain). But the width between samples is not always one, and therefore the area (length x width) under a single sample is not simply the amplitude (length) times 1 (width) - it is the amplitude (length) times "dt" (width = time increment between samples). In order to correct for the fact that the discrete integral is essentially computed assuming an Fs = 1, you need to multiply the result by dt = 1/Fs.

Connectez-vous pour commenter.


Dr. Seis
Dr. Seis le 25 Mai 2012
See my answer here:
In order to conserve energy in a signal whose length does not happen to be the same number as the one associated with the sampling frequency (Fs) - the third example in Honglei Chen's post has a signal that is 1025 samples long and an Fs of 1024 - then you need to scale the result of the FFT by the sampling frequency. This example that is provided by Matlab is just plain WRONG and needs to be changed !!!
Another example is that of a spike in the time domain at time = 0 and zeros at every other time sample. A true spike, by definition, should have infinite amplitude and width of 1/infinity (see http://en.wikipedia.org/wiki/Dirac_delta_function) such that the Fourier transform of it (in a continuous domain) would result in 1 at all frequencies between -inf to +inf. We do not have infinitesimally small sampling frequency, so the amplitude of the spike (or Dirac delta) in the time domain must be equal to the number represented by Fs. In the frequency domain, we only get 1's at all of our frequencies if we divide the FFT result by Fs (unless of course our signal happens to have a length equal to the number associated with Fs... then by all means divide your result by the length of your signal because it won't matter).
  1 commentaire
Kenny
Kenny le 14 Fév 2018
A 'spike' having 'infinite' amplitude and 'zero width' is definable --- as we can certainly give it a definition. But as far as conservation of 'energy' is concerned, the energy in a spike is uncontained, or infinite, right? So the amount of energy in a time-domain spike is 'undefined' right?
I can understand conservation of energy for time domain signal that drops off to zero at some point in the negative and positive time values. But for those signals that don't drop off to zero, then probably can't talk about conservation of (infinite) energy, right? Because infinite is unbounded.

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by