For the ones who try to understand the consequences of certain settings in the FFT analysis – this is about the window functions.
Why are there so many different windows (only few of them available on the SDS oscilloscope)? What is the best window to use?
There are descriptions about the benefits and drawbacks of the various window functions, yet most folks don’t care and rather want a universal setting that works for them everytime. And fortunately there is one…
There are several features of a window function, and two of them are amplitude accuracy and resolution bandwidth. If we look at just these properties, then the rectangle window would have the narrowest resolution bandwidth but the worst amplitude error, whereas it’s just the opposite for the Flattop window.
So, whenever we need the best frequency resolution, we just sacrifice a bit accuracy and use the Rectangle window?
It’s not that simple. An FFT divides the entire analysis bandwidth into frequency bins. If, for instance, we have an FFT-length of 262144 points, then we get 131072 such frequency bins and at an effective sample rate of 400 MSa/s each of them will be 1526 Hz wide. In this case, 1526 Hz is the bin width and the bin spacing at the same time. The center of a bin will always be an integer multiple of the bin width.
Now FFT-windows behave differently, depending on the offset of the input signal frequency from the bin center. I did the test for the various window functions available on an SDS2000X Plus and used the before mentioned parameters:
FFT-sample rate = 400 MSa/s
FFT-Length = 262144 pts
Bin-width = 1526 Hz
The test will be for amplitude accuracy and the -40 dB bandwidth. Why -40 dB? Resolution bandwidth is normally defined at -3 dB.
Answer: because -3 dB might be most important for characterizing the passband of a wideband structure, but for a filter, where the selectivity is the main concern, the bandwidth at a useful attenuation is even more important, because this is what finally enables us to distinguish various spectral components. -60 dB might have been even more appropriate, but the FFT window functions cannot always provide such a stopband attenuation in certain cases.
A 0 dBm test signal of 9.999084 MHz has been used for the following test, this is precisely 6553 times the bin width, hence the exact center of a bin.
What do we get?
Window Top Ampl. [dBm] -40 dB BW [Hz]
Rectangle 0,058 1710
Blackman 0,038 6940
Hanning 0,038 4360
Hamming 0,066 4260
Flattop 0,027 12430
As we can see, the rectangle window is fantastic. It has a very low amplitude error of less than 0.1 dB and an ultra-narrow bandwidth of just 1710 Hz for -40 dB. Yes, the Flattop window seems to be tad more accurate, but look at the bandwidth – wide as a barn door! All the experts that tell us that the rectangle window should best be avoided must clearly be idiots.
The only problem is, that our signals will not always be an exact integer multiple of the bin-width.
In any practical application where the FFT of a general-purpose oscilloscope is to be used, we often cannot freely define the signal frequencies, hence thy will be more or less off center. Even if we can select a frequency, then most related signals like harmonics and intermodulation (mixer) products can have any frequency offset with regard to the bin spacing. Consequently, we need to take the worst case into consideration, that is a frequency offset of half the bin-width.
A 0 dBm test signal of 9.999847 MHz has been used for the following test, this is precisely 6553,5 times the bin width, hence the exact bin-border.
Window Top Ampl. [dBm] -40 dB BW [Hz]
Rectangle -3,879 96300
Blackman -1,028 8060
Hanning -1,377 10070
Hamming -1,689 6400
Flattop 0,027 12480
This looks very different, doesn’t it? All of a sudden, the rectangle window has the widest bandwidth by quite a margin together with a massive amplitude error. By contrast, the Flattop window hasn’t changed at all: the amplitude error is effectively zero as it was before and the also the -40 dB bandwidth remains unchanged.
So yes, the Rectangle window is the worst choice by far and should be avoided by all means.
What we can see from these measurements, Hanning, even though way better than Rectangle, is clearly not ideal either. Even though it can produce a substantial error of nearly 1.4 dB, its -40 dB bandwidth comes close to Flattop.
Hamming has half the bandwidth but nearly 1.7 dB maximum error.
Blackman has two third of the Flattop bandwidth and a still bearable 1 dB error, so it might be an alternative.
But if we are realistic, none of the other windows has a significantly narrower bandwidth as long as we cannot guarantee that all signal frequencies of interest are at an exact bin-center. As a consequence, Flattop is our best bet by quite some margin.
There are yet other aspects, like leakage and side lobes. Window functions can waste a significant amount of energy in side lobes. The Flattop window is very good in these regards and will also guarantee a usable -60 dB stopband regardless of the frequency offset.
Look at the attached screenshots. They show the filter shape and measurements of each window function for the best case (0.0 offset) as well the worst case (0.5 offset).
SDS2354X Plus_FFT_Rectangle_0.0
SDS2354X Plus_FFT_Rectangle_0.5
SDS2354X Plus_FFT_Blackman_0.0
SDS2354X Plus_FFT_Blackman_0.5
SDS2354X Plus_FFT_Hanning_0.0
SDS2354X Plus_FFT_Hanning_0.5
SDS2354X Plus_FFT_Hamming_0.0
SDS2354X Plus_FFT_Hamming_0.5
SDS2354X Plus_FFT_FlatTop_0.0
SDS2354X Plus_FFT_FlatTop_0.5