# Windowing of signal before FFT

I am facing an interesting problem: I have a signal in the time domain. In order to avoid discontinuities at the edges of the signal --- which would lead to artifacts when calculating the FFT --- I apply a window function, like e.g. hann or hamming. Then I perform the FFT of this windowed signal.

To preserve the energy of the signal after the FFT, I calibrate the FFT of the windowed signal with the RMS of the window function. However, the strange thing is that the energy (=area under the curve) of the windowed signal in the frequency domain is substantially different (about a factor of 2) compared to the FFT of the unwindowed signal.

Do you have an idea where this issue could originate from?

• Do you apply overlap-add? Apr 9 at 1:04
• No not yet - what do you mean by the overlap-add and would this help here? Apr 9 at 7:50
• Are you processing the signal frame by frame? If yes, then you should apply overlap-add and not calibrate with RMS of the window function. See here Apr 9 at 9:14
• No it is not processed frame by frame - I take the FFT of the complete trace, i.e. the calculation is something like fft(signal * windowfunction)/rms(windowfunction) Apr 9 at 9:32

So you think that the energy of the windowed signal in the frequency domain equals to the original signal multiplied by a certain value related to RMS of the window function, which is wrong. According to Parseval's theorem, the total energy of a signal can be calculated by summing power-per-sample across time or spectral power across frequency:

$$\sum_{n=0}^{N-1} |x[n]|^2 = \frac{1}{N}\sum_{k=0}^{N-1}|X[k]|^2$$

Hence I'm going to prove your statement wrong in the time domain.

The energy of a windowed signal $$w[n]x[n]$$ is

$$\sum_{n=0}^{N-1} |w[n]x[n]|^2 = \sum_{n=0}^{N-1} |w[n]|^2|x[n]|^2 \neq C\sum_{n=0}^{N-1} |x[n]|^2$$

where $$C$$ is a constant. The above inequality holds true as long as the window function $$w[n]$$ is not a rectangular window.

• Wow that's very interesting - so that shows probably the main problem here. Thank you very much for your help, that's really helpful! I am wondering, however, how one could then calculate e.g. the PSD of a signal in the frequency domain. If I had a periodic signal, I could just calculate the fft of the signal and calculate |fft(signal)|^2. But what if the signal is not periodic so that a window function becomes necessary? Is there a way that still find the correct PSD even if a windowfunction is used for the signal in the time domain? Apr 9 at 11:17
• If $N$ is very large and you make some assumptions about the orthogonality of $w[n]$ to $x[n]$, there is an assumption you can make about $C$. Apr 10 at 13:58

When computing the PSD of a windowed function we must account for the increased width and hence overlap of the main lobe of the windows kernel. A single tone does not span multiple bins and thus the computed RMS level will be accurately determined from the coherent loss of the window, however a signal that has a spectral density that spans multiple bins (such as white noise) will result in an overestimate of the rms level due to this double counting within each bin.

I detail this effect and the computations that can be used to accurately measure the rms signal level from a windowed DFT here in this post:

Find the Equivalent Noise Bandwidth