# Differences in PSD for windowed vs non-windowed spectra

For a non-windowed spectrum, this article gives this equation for the power spectrum $$\text{PS}(k)=\frac{1}{N^2}|X(k)|^2$$ and this for the power spectrum density $$\text{PSD}(k)=\frac{N}{f_s}\text{PS}(k)=\frac{1}{Nf_s}|X(k)|^2$$However if I window my data with $$\omega(n)$$, then these equations become $$\text{PS}(k)=\frac{1}{(\sum_n\omega(n))^2}|X(k)|^2$$ $$\text{PSD}(k)=\frac{1}{f_s\sum_n\omega^2(n)}|X(k)|^2$$Why does the power spectrum set $$N=\sum_n\omega(n)$$ but power spectral density to $$N=\sum_n\omega^2(n)$$? Is there a physical principle for this?

• Please see this reference and if anything’s unclear come back with more!
– Jdip
Apr 14 at 22:08

The equivalent noise bandwidth (ENBW) for a given window $$w[n]$$ is the reciprocal of the window's processing gain and given as:

$$ENBW_{bins} = N\frac{\sum(w[n])^2}{(\sum w[n])^2} \tag{1} \label{1}$$

The suffix "bins" is to denote that the units of the result in in bins of the DFT.

(See DSP.SE# 88447 for a more detailed explanation on the ENBW formula)

Therefore we can get the ENBW in units of Hz by multiplying \ref{1} by $$f_s/N$$ to translate bins to Hz, resulting in:

$$ENBW_{Hz} = f_s\frac{\sum(w[n])^2}{(\sum w[n])^2} \tag{2} \label{2}$$

The power spectral density in units of W/Hz is the spectrum in Watts divided by the ENBW in Hz. Using the OP's result for the spectrum and \ref{2} for the ENBW we get:

$$PSD[k] = \frac{PS[k]}{ENBW_{Hz}}$$

$$PS[k] = \frac{|X[k]|^2}{(\sum w[n])^2}$$

$$PSD[k] = \frac{|X[k]|^2}{(\sum w[n])^2}/ \bigg( f_s\frac{\sum(w[n])^2}{(\sum w[n])^2}\bigg) = \frac{|X[k]|^2}{f_s\sum(w[n]^2)}$$

The power spectrum is useful for providing an estimate of single tones while the power spectral density is useful for providing an estimate of noise or any waveform where the noise density is spread across multiple DFT bins (and specifically spread over the resolution bandwidth or equivalent noise bandwidth of the window). I detail the comparison of both approaches in DSP.SE #87723.

See this answer I gave recently that discusses this topic. The scaling of the PSD is not a once and for all scaling, as how you estimate the PSD determines the appropriate scaling. The scaling of the PSD you give only holds for periodogram estimates. Welch's method or other periodogram derivative methods require a different scaling.

Additionally, as I understand it, the scale factor difference between the PSD and the power spectrum defined as is requires the noise to be white, as the PS attempts to account for the noise output power due to the filter's bandwidth. That is to say, the PS sums up the power contributions across the effective bandwidth of the filter.

The difference in scaling between the PS and the PSD, according to these definitions, is $$ENBW$$, the effective noise bandwidth. The effective noise bandwidth is the bandwidth of an ideal bandpass filter that accumulates the same amount of noise power as the filter $$H$$. We can call this filter $$H_{B}$$. We want to find the solution such that $$|H_{B}|^{2} = |H|^{2}$$ subject to the constraint $$|H_{B}(f_{0})|^{2} = |H(f_{0})|^{2}$$. The power accumulated by a filter is

$$$$P_{filt} = \int_{-\infty}^{\infty}|H(f)|^{2}df$$$$

Since an ideal filter has a rectangular spectrum, the power in it can be computed as

$$$$P_{ideal} = ENBW|H_{B}(f_{0})|^{2} = ENBW|H(f_{0})|^{2}$$$$

We wish to compute $$ENBW$$ such that $$P_{ideal} = P_{filt}$$, so we get

$$$$ENBW = \frac{\int_{-\infty}^{\infty}|H(f)|^{2}df}{|H(f_{0})|^{2}}$$$$

Moving into the discrete world and applying Parseval's theorem gives

$$$$ENBW = N\frac{\sum_{n}|h[n]|^{2}}{|\sum_{n}h[n]|^{2}}$$$$ See here for more details on this.

Now, let $$S_{n}(f)$$ be the noise PSD. To calculate the power output of the filter due to the noise PSD, we can say

$$$$P_{out} = \int_{-\infty}^{\infty}S_{n}(f)|H(f)|^{2}df = |H(f_{0})|^{2}\int_{f_{0}-\frac{ENBW}{2}}^{f_{0}+\frac{ENBW}{2}}S_{n}(f)df$$$$

This is an important description as the PSD can be viewed as the expected output of a filterbank. If the noise is white with constant $$\frac{N_{0}}{2}$$, we can say

$$$$P_{out} = \frac{N_{0}}{2}|H(f_{0})|^{2}ENBW \propto \frac{N_{0}}{2}ENBW$$$$ As we can see, the power spectrum over $$ENBW$$ bandwidth is the PSD multiplied by $$ENBW$$, so this scales well to computing the PS over all frequency bands.

This analysis breaks down in two cases, the first of which I already mentioned which is where you have colored noise. If there is colored noise, then the power output of the filter due to the noise is not equivalent to a scaled version of the filter power/gain because filters with equivalent bandwidths centered at different frequencies may experience different power gains. That is to say, $$S_{n}(f)$$ is dependent on $$f$$, and cannot be moved outside the integral when computing $$P_{out}$$. However, practically speaking, if the noise is slowly varying with frequency, and the PSD is sampled sufficiently, you can approximate the noise as being white across each small bandwidth, which may allow you to obtain a reasonable approximation. (EDIT: Per a discussion in the comments, it was brought to my attention that a better condition for practically obtaining a sufficient approximation of the PS is that the noise be approximately white over the bandwidth of the mainlobe of the window used. If proper windowing is used, the noise outside of the mainlobe will contribute an insignificant amount to the total power as the window sidelobes are significantly lower than the mainlobe. This emphasizes an important point: windows are important for accurate approximation of spectra when noise statistics are unknown as they mitigate the contribution of non-white noise in the sidelobes into the effective noise bandwidth. If proper windowing is used, then this analysis becomes a mathematical technicality as opposed to having a potentially detrimental effect on the PS estimate.)

Second, if you have a data-dependent filter, of which most modern methods of PSD estimation are based on, this description again breaks down as the bandwidth is not guaranteed to be proportional to the filter length, which means that we can't use the previous definition of $$ENBW$$. If you have a statistical description of the filter bandwidth you can get a statistical estimate of the PS, again under the assumption the noise is white.

• @DanBoschen good point. You probably wouldn’t see much error in reality, so it ends up being more of a mathematical technicality. I would still say the second point about modern PSD spectra is valid, though. Scaling to the PS, based on what it’s trying to account for, would seem to suffer greatly from the downsides of classical Fourier methods. Modern techniques like AR PSDs would likely still produce better spectra for tones than classical Fourier based PSs. Just a guess though. Apr 15 at 16:35
• @DanBoschen just updated. Let me know if the edit I made is sufficient and accurately captures what you correctly pointed out. Apr 15 at 17:54