I was just wondering... The formula I learned to calculate the energy of the signal is expressed in the time domain:

$$E_x^{\text{time}} = \sum_{n=-\infty}^{\infty} |x[n]|^2$$

Then, what does the amount of energy gotten from the magnitude spectrum mean?

$$E_x^{\text{frequency}} = \sum_{f=0}^{fs/2} |X[f]|^2$$

Supposing that both amplitudes are expressed in decibels, $fs/2$ is the maximum representable frequency (by Nyquist theorem), and $E_x^{\text{frequency}}$ is taken over the same time frame as $E_x^{\text{time}}$. Should the quantities be the same?

  • $\begingroup$ First of all second equation is not applicable to logarithmic scale as addition does not hold. Secondly Assuming that $X(f)$ is correctly scaled magnitude (taking windowing function into account, i.e. division by number of samples and doubling the energy from negative frequencies), then yes - these to should be the same. $\endgroup$
    – jojeck
    Jan 27, 2015 at 17:54
  • $\begingroup$ Quick example in Python (I am not taking amplitudes up to $f_s/2$ because it is bit pointless. If you want, then don't forget that DC coefficient is not multiplied by 2 when restoring energy. import numpy as np; # Number of samples N=100; # Generate the time domain signal x=np.random.randn(N); # Get the magnitude X=np.abs(np.fft.fft(x)); # Calculate the energies Et=np.sum(x**2); Ef=np.sum(X**2)/N; print "Et = %.1f" % Et; print "Ef = %.1f" % Ef; $\endgroup$
    – jojeck
    Jan 27, 2015 at 18:16
  • $\begingroup$ One thing to keep in mind: if $x[n]$ is periodic, then its energy is infinite, and it's better to measure its power. The FFT assumes the signal is periodic. You need to be careful and make sure you understand what you're measuring. $\endgroup$
    – MBaz
    Jan 27, 2015 at 18:35

1 Answer 1


You need Parseval's theorem. For the discrete-time Fourier transform (DTFT) you have the following relation:


where $f$ is normalized by the sampling frequency. For the DFT you have


So due to Parseval's theorem it is always possible to compute a signal's energy in the time domain as well as in the frequency domain.


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.