MATLAB - Windowing Part 3
27 Aug 2008 Quan Quach 5 comments 1,935 views
This is the eighth post in the blinkdagger signal processing series.
In this post, we’re going to discuss the proper window to choose based on the application and the situation. For the most part (95% of the time) you’ll be best off using the Hanning (Hann) Window because of its versatility and overall effectiveness across the board. Of course, there are exceptions, so read on to learn more about windows and their characteristics.
Contents
- The Fantastic Four
- Spectral Resolution and Spectral Leakage
- Amplitude Accuracy
- Examples of Three Different Windows
- Other Considerations
- References
The Fantastic Four
When it comes to windowing, there are four main things to consider: signal type, spectral resolution, spectral leakage, amplitude accuracy. Below is a nice table that is lifted from this document that shows which window to use in a particular situation:
Spectral Resolution and Spectral Leakage
When two peaks are very close to each other, it can be difficult to differentiate between the two peaks. In this case it is desirable to increase the spectral resolution so that you can more easily differentiate between these two peaks. The main characteristic of the window that drives spectral resolution is the width of the main lobe. The shorter the width, the better the resolution.
We discussed what spectral leakage is in an earlier post. Basically, spectral leakage is energy within a frequency bin that shouldn’t be there. The amount of spectral leakage is also dependent on the main lobe width. The shorter the width of the main lobe, the MORE spectral leakage. Thus, there is a trade off between mitigating spectral leakage and obtaining better spectral resolution.
Amplitude Accuracy
Amplitude accuracy at a particular frequency can be of extreme importance. If you want to most accurately indicate the level of a peak, then the Flat Top Window (shown below) is the window to use. The maximum sidelobe level is the main factor in determining your amplitude accuracy. The lower your maximum sidelobe level relative to the main lobe, the better the amplitude accuracy will be.
Examples of Three Different Windows
Below are figures for the Flat Top, Blackman, and Hanning Windows. Notice that for the Flat Top Window, the maximum sidelobe level is much lower than other windows. Also note the width of of the main lobe for each window. The Hanning window has the narrowest main lobe of the three and has the best frequency resolution among the three. The Flat Top and Blackman window have wider main lobe and offer better mitigation of spectral leakage.
Other Considerations
If there is a lot of interference far away from the frequency of interest, then you want to choose a window with a high sidelobe roll-off rate. Similary, if there is a lot of interference near the frequency of
interest, then you should choose a window with a low sidelobe roll-off rate.
Impact measurements are an interesting class of signals. In these cases, an exponential decaying window should be used. This window forces the response to zero at the end of the signal (which incidentally will cause your damping estimates to be higher!).
This will be the end of my mini-series on windowing. For more information, please visit the references that are listed below. They go into much more depth and offer plenty of examples that are extremely useful.
References
5 Responses to “MATLAB - Windowing Part 3”
Leave a Reply
Include MATLAB code in your comment by doing the following:
<pre lang="MATLAB">
%insert code here
</pre>


Hi.
I have spent may hours considdering different windows for different applications, but lately I have come to realize that unless your signal has well-defined sharp peaks it really doesn’t matter what window you use. When for example calculating the first moment sum(P(w)*w) the effects of a window are negiligble unless in input signal is a pure sine-curve.
–DA
Thanks very much.
That was so benificial, keep up the good work on this brilliant blog!
Hi.
Recently I was reading your great blog and tried using the Windows Visualization Tool to compare the Flattop and Hanning window. However, I don’t understand how the option Magnitude (dB) for the y-axis in the frequency domain is defined, since the maximal value is greater than 0 dB. For definition of the magnitude in dB I expected something like:
Magnitude (dB) = 20 log_{10} \frac{W(\Omega)}{W(0)} /in LaTeX/
According to above formula, the maximal value is 0 dB if W(0) is the
highest amplitude in spectra and that’s what you have in your plots as well. However, I get a maximum value of +23.8dB for the Hanning window and +16.5dB for the Flattop window. Can you explain me why I get that?
Thanks
The Magnitude is normalized. Just go to the the tab View- Analysis Parameters and select normalized amplitude in the check box at the window bottom-left.
[...] http://blinkdagger.com/matlab/matlab-windowing-part-3 [...]