# Evaluate performance of FFT Windows

lately i've been interested in FFT windowing, i've experimented various windows in Matlab, that made me more curious:

There are normalized parameters (CG, Scalloping loss etc...) for every window

How those parameters were measured? for what type of signals? what are the frequency, amplitude of those signal? what is the Frequency sampling used? what is the length N of the FFT?

is there a standardized framework to use for evaluating windows.? what if i want to do an evaluation my self, what initial conditions i should choose ?

• The Wikipedia article on this is surprisingly well written: en.wikipedia.org/wiki/Window_function – Hilmar Aug 30 at 10:51
• Thanks but The wikipedia article is only describing the functions, i'm seeking a normalized way of evaluating performance, it 's like that you want to compare apples, you need to set the same initial conditions for comparison – carterwild Sep 3 at 9:57

The good thing about filters is that they are linear. Therefore you do not need to specify the signal when you are analyzing the filter. You just analyze its impulse response (i.e., filtering an ideal Dirac pulse) and the Fourier transform of that (the transfer function). Based on this analysis, you can judge what the filter would do to any given signal.

For windowing, almost the same is true, just a little backwards: windowing means multiplication in time domain, which is convolution in frequency domain. So it's almost the same as filtering, just exchanging the role of time and frequency domain. Therefore, we can do the same: analyze the window function and its Fourier transform itself, not assuming any specific signal. That's what would happen for a single Dirac pulse in frequency (i.e., a constant DC signal). Then, if you want to know what happens when you window a given signal, just apply convolution in frequency domain (e.g., for a pure tone, that's just shifting it).

That said, most of the table can be filled by computing the Fourier transform of the window function and then taking the corresponding measurements: how large/wide are the mainlobes, etc. If you cannot compute the Fourier transform analytically, you can try to approximate it, using a Discrete Fourier transform. In this case, use a large $$N$$, to make sure your estimation errors remain negligible.

*edit: Regarding your question on the estimation of power: if you want peak heights to be consistent you'll have to normalize your windows accordingly. Since the spectrum of a windowed signal is $$X_h(f) = X(f) * H(f)$$, i.e., convolution with the spectrum of the window function, the normalization of $$H(f)$$ matters. For instance, for a small peak to come out in the correct height, you might want to have $$H(0)=0$$, which means that the coefficients in time domain should sum to one. Alternatively, if you want your windowed signal to behave like the unwindowed one, take into account that applying "no window" means implicitly applying a rectangular window of amplitude 1, so that its coefficients sum to $$N$$.

In Matlab:

clear;
N = 999;
fs = 2000;
f0 = 200;

taxis = (0:N-1)/fs;
faxis = (0:N-1)/N*fs;
sig = sin(2*pi*taxis*f0);

win = flattopwin(N).';
sig_win = sig.*win;

win_normalized = win/sum(win)*N;
sig_win_normalized = sig.*win_normalized;

figure(1);
clf;
plot(faxis,abs(fft(sig))/N);
hold on;
plot(faxis,abs(fft(sig_win))/N);
plot(faxis,abs(fft(sig_win_normalized))/N);
legend('Rect','Flattop','Flattop normalized')
xlabel('f [Hz]');

set(gca,'YScale','log');


Result (zoomed in around 200):

You can see how with the normalization you can make the flattop window behave like the rectangular window.

Btw: the units of this are not dBm. It's a discrete Fourier transform, transforming Volts into Volts (or unitless quantities into unitless). If you want dBm you have to properly normalize to make sure your FFT approximates a Fourier transform (it involves the sampling time $$t_0$$) and you'll have to estimate power instead of amplitude.

• ha you made me think about digital filters comparison ('ill do it later...). What i try to do is to check the accuracy of the CG, SL ...values using my own simulations – carterwild Sep 3 at 10:17
• i use a sampling frequency of 200000 samp/sec for 1 sec observation; NFFT=8192; and a 30000 Hz sin signal, here are my results imgur.com/DPdwC8i in top right : the signal multiplied by flattop window, and (signal + 0.2*whitenoise ) multiplied by same window, in top left FFT of both signal and signal+noise with no window, down under the FFT of both signal and signal+noise but window applied this time; – carterwild Sep 3 at 10:31
• for 10dbm orginal signal; the FFT with no window is 9.93 dbm (FFT leakage because of resolution choice) but the flattop which is supposed to be good for amplitude measurements, is showing a -50 dbm?! this is one example of simulations, in overall after a dozen one (changing the Fs, N etc..) i noticed windows seems to work optimally only with small resolution? even in frequency bin represent less than 1Hz.? – carterwild Sep 3 at 10:36
• Not sure what happened there, was your FFT resolution fine enough so you don't "miss" the peak? Otherwise, check the scaling of your window function in time domain, it could be off too (though the time domain signals look okay). Compare the scaling of the windowed and unwindowed signals in time domain. Is it similar? Then the scaling in FFT domain should be similar too (there is Parseval's theorem, after all). Note that the DFT also scales with $1/N$, if you want to estimate power, you have to be careful to scale it properly. – Florian Sep 5 at 16:00
• Such a good effort to answer. I wonder why it didn't get credit. +1. – David Oct 17 at 11:23

In Matlab i found i useful too wintool, it shows time domain and frequency domain response of windows. You can compare based on some parameters such as sidelobes..par not all parameters. Best regards