For example, performing a DFT on a 10-second-long and 20-second-long signal with the same sampling frequencies will change the "amplitude" of the power spectral density (PSD) at each frequency because of the difference in frequency resolution, but the integral of the PSD will be the same. Is my understanding correct?


1 Answer 1


Yes I believe the OP understands correctly with some clarification. Ultimately we need to properly label the spectrum to either be a spectrum plot with a given resolution bandwidth, or a true PSD that has been normalized to frequency units (such as dBm/Hz). This is no different than a measurement of a noise or wideband signal using a spectrum analyzer for those familiar with that. The properly normalized PSD plot will not change as we increase or decrease the total number of bins, while a spectrum plot will have the measurement level for noise or wideband signal go up and down as the number of bins is changed (changing the resolution bandwidth accordingly). Each bin in the DFT is the integration of the total power under the frequency response for that bin as a bandpass filter (the frequency response of each bin is an aliased Sinc function, specifically the Dirichlet Kernel). For white noise, this total power is equivalent to that of a brickwall filter that is 1 bin wide. Thus for noise signals where the power is spread across multiple bins and given as a power spectral density in W / Hz (or other power per frequency units), when the DFT is properly scaled (see those details further below) the total magnitude squared of the DFT (as the integrated total power within the bin) will scale with the number of bins used given the same sampling rate, according to the resolution bandwidth for that bin. And the total power sum of all the bin (sum of $(\frac{1}{N}X[k])^2$) will be equal to the total power in the time domain, as given by Parseval's Theorem. The power in each bin is referred to as the "DFT Noise Floor" which I detail further in this post: Does the duration of a signal affect its frequency component's amplitude? Also, does the sampling frequency affect the power of a signal?

This post explaining how the DFT is equivalently a bank of filters should be helpful too in understanding the concept of how the noise floor of the DFT for white noise signals scales by the total number of bins (and samples) used: Can anyone explain how dft works as a filter bank?

A scaling by $N$ of the DFT result is required to have the same amplitude as the time domain signal. Consider the simple case of a sinusoid where the sampling rate is an integer multiple of the frequency (to avoid getting into spectral leakage effects for a simple example):

$$x[n] = A\cos(2 \pi (f/f_s) n)$$

Where $A$ is the real magnitude, and $f_s$ is the sampling rate as an integer multiple of $f$.

Using Euler's relationship we know this is:

$$x[n] = \cos(\omega_n n) = \frac{A}{2}e^{j\omega_n n} + \frac{A}{2}e^{-j\omega_nn}$$

Where $\omega_n = 2 \pi (f/f_s)$.

Every component in the DFT result is the coefficient for a $e^{j\omega n}$ in the time domain, so the DFT of a sinusoid with the corrected magnitude should have two components each with magnitude $A/2$ per the formula shown above (one component for the positive frequency given by $e^{j\omega_n n}$, and another for the negative frequency given by $e^{-j\omega_n n}$. For real signals the positive and negative frequency will be complex conjugate symmetric, so we can provide all information from the positive frequencies only, in which case if we only used half of the DFT bins relating to the positive frequency components, we would need to increase the resulting PSD by 3 dB to include the total power from both sides).

Observe in the DFT formula given as:

$$X(k) = \sum_{n=0}^{N-1}x[n]e^{-j2\pi n k/N}$$

When $2\pi n k/N = \omega_n$, the product in the summation will be $A/2$ and so the sum will grow to $NA/2$, so scaling by $N$ results in the matching amplitude of the coefficient of the $e^{j\omega t}$ time domain waveform.

Further, since the magnitude for $\frac{A}{2}e^{\omega_n t}$ is constant the power is simply $ (\frac{A}{2})^2$ and not divided by $2$ as we would do with the sinusoid. And all bins sum in power so that the total power of $x[n]$ correctly equals $ (\frac{A}{2})^2 + (\frac{A}{2})^2 = 2(\frac{A}{2})^2 = \frac{A^2}{2}$ and we happily get that factor of 2 for the sinusoid we are familiar with.

For single tones and narrow band signals that are less than the resolution bandwidth of the DFT bin, there is no effect on resolution bandwidth as the power for the signal has no distribution (meaning the power of the signal occupies a bandwidth that is 0 wide, so no matter how tight or loose we make the resolution bandwidth on a spectrum analyzer like the DFT we will get the same magnitude result, when properly scaled as I demonstrated). It is when we get into waveforms with bandwidth (and noise in general) that we must be careful about the effects of resolution bandwidth, windowing, etc in using the DFT for accurate power spectral density measurements. I address this in these other posts here on StackExchange:

How can I get the power of a specific frequency band after FFT?

Proof for the energy correction factor of DFT

  • $\begingroup$ Thank you. I understood the point. I was trying to calculate the PSD of a 10 second and 20 second sinusoidal signal using matplotlib.mlab.psd() function. I didn't understand why the magnitude of the PSD was different between those. I was confused with the difference of a radom signal and a sinusoidal (periodic) signal. $\endgroup$
    – Tom
    Jan 12 at 2:04
  • $\begingroup$ @Tom I think I better understand your question and added an introductory paragraph specific to that. Is that what you were looking for? $\endgroup$ Jan 12 at 2:37
  • $\begingroup$ Yes, thank you very much for you help! $\endgroup$
    – Tom
    Jan 12 at 5:23

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.