2
$\begingroup$

I have two questions regarding power spectra and energy of a signal:

  1. For power spectra calculation I used STFT, and I saw that the value of STFT should be normalized before applying logarithmic function. The normalization is done by multiplying them by $2/\mbox{window length}$. What is the reason?

  2. I also want to calculate the energy of the signal according to Parseval theorem and using STFT. Should I use the average of STFTs or the sum of them?

$\endgroup$
2
  • $\begingroup$ because different FFT implementations sometimes have different scaling applied, it would be nice to know what you're using. is it MATLAB? what window function might you be using? $\endgroup$ Mar 17, 2017 at 16:27
  • $\begingroup$ Dear @robert . yeah, that is in MATLAB. The window is hamming and the code is [45197-short-time-fourier-transformation--stft--with-matlab-implementation] $\endgroup$
    – reo
    Mar 18, 2017 at 18:39

1 Answer 1

2
$\begingroup$

The STFT yields complex values. Energy conservation (up to a scaling factor) should apply to the square of its magnitude, also called spectrogram. Depending on

  1. the initial normalization of the FFT,
  2. the window shape,
  3. the lag (do you compute the FFT every $h$ sample, $h$ is called the hop, sometimes),

the scaling factor will differ, but will be the same for all signals.

  1. $2$/window length is specific to a choice of the three parameters above. A scaling factor will only result in a $\log$-magnitude shift, which does not really matter for display or relative energy.

  2. If you can compute the energy normalization based on the three parameters above, good. If not, take a randomly-picked signal (non zero), compute the ratio between the energy of the signal and that of the spectrogram, and you have your factor. Beware of the border effect, better take a centered signal with enough zeros (above the window support) on the right and the left.

$\endgroup$
2
  • 3
    $\begingroup$ Dear @Laurent, what is the initial normalization of the FFT?I mean how can I apply that? my computations involve also some lag. so you mean that when I use this normalization, it is something depend on my data? and I didn't understand your second note about energy. should I use the average value of each time frame?or the only sum of them?my window is hamming and I didn't use any normalization on data. Could I ask you to give a reference for your second note?or these are something which is earned by experience. $\endgroup$
    – reo
    Mar 18, 2017 at 18:50
  • 1
    $\begingroup$ The normalization should not depend on data. Energy preservation should be valid for all signals $\endgroup$ Mar 18, 2017 at 21:19

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.