Window Types: Hanning, Flattop, Uniform, Tukey, and Exponential
There are several different types of windows used to reduce spectral leakage when performing a Fourier Transform on time data and converting it into the frequency domain.
Each window is designed with a specific purpose. The details and tradeoffs of the following windows will be covered in this article:
Throughout the article, the term measurement time refers to the amount of time to acquire a single average or FFT of data. Measurement time can also be referred to as frame size.
Periodic versus Non-Periodic Background
Before delving into the specifics of each window, it is helpful to understand spectral leakage in light of signals captured in a periodic or non-periodic manner. Any signal data, based on how it is captured by the measurement time, is either periodic or non-periodic.
When performing a Fourier Transform on measurement data, a window affects periodic and non-periodic data differently:
By varying the measurement time, the same signal can be made periodic or non-periodic as shown in Figures 1 and 2.
When a measurement signal is captured in a periodic manner, if it is duplicated and appended many times over, it will be identical to the original signal (Figure 1). The signal is repeated and appended mathematically because the measured data is assumed to be representative of the entire original signal.
For a periodic signal, the Fourier Transform of the captured signal will have no leakage in the frequency domain, as shown in Figure 3. A window is not recommended for a periodic signal as it will distort the signal in an unnecessary manner, and actually creates spectral leakage.
The same sine wave, with a different measurement time, results in a non-periodic captured signal as shown in Figure 2.
Here, when the captured signal is repeated, the original sine wave signal is not re-created. In fact, several broadband transient events (circled in red in Figure 2) are introduced. These transients create a broadband response, or leakage, as shown in Figure 3.
Windows are used to minimize this leakage effect in the frequency domain. The Knowledge Base article 'Leakage and Windows' has further details on how windows minimize the effects of leakage.
In several of the examples provided in the article, a frequency domain plot of the effects of a window on periodic and non-periodic data is displayed.
When doing operational noise and vibration measurements, the Hanning window is commonly used.
Many operational signals are random in nature as shown in Figure 4. Examples of random signals can include sound generated by driving on a road, vibration while a pump/motor is operating, or the sound of a faucet with running water.
Random data has spectral leakage due to the abrupt cutoff at the beginning and end of the time block. It is non-periodic. There is no way to ensure that the captured random signal is periodic by varying the measurement time. A random signal is composed of many different frequencies, and even if the acquisition time was adjusted to capture some frequencies without creating leakage, other frequencies would be non-periodic.
Hanning windows are often used with random data because they have moderate impact on the frequency resolution and amplitude accuracy of the resulting frequency spectrum, especially when compared to the effects of other windows. The maximum amplitude error of a Hanning window is 15%, while the frequency leakage is typically confined to 1.5 spectral lines to each side of the original sine wave signal.
The maximum amplitude error of 15% is even the case with window correction factors applied. If the Hanning window is used on sine wave that is captured periodically, the error would be 0%. The maximum error of 15% occurs when the sine wave is half way between two spectral lines. If the sine wave frequency was one fourth of the distance between two spectral lines, the amplitude error would be 7.5%.
The Hanning window starts at a value of zero and ends at a value of zero (Figure 5). In the center of the window, it has a value of one. This gradual transition between 0 and 1 ensures a smooth change in amplitudes when multiplying the measured signal by the window, which helps reduce the spectral leakage.
In Figure 6, a periodic sine wave is shown with and without a Hanning window applied. Applying the Hanning window (or any window) to a periodic signal creates leakage. In the figure, the sine wave with the Hanning window (blue) is wider in frequency than the original signal (red).
When a Hanning window is applied to a non-periodic signal, as shown in Figure 7, the leakage is greatly reduced and the amplitude is higher.
The maximum amplitude error can be seen when viewing the spectrum of a non-periodic sine wave.
Using a RMS calculation around the frequency peak yields the correct value when a window is applied as shown in Figure 8. The RMS value of a sine wave with peak amplitude of one is 0.707 amplitude.
A RMS calculation sums up the energy within a frequency range. In Figure 8, both the RMS of the periodic and non-periodic signals with a Hanning window are equal to the RMS of the leakage-free sine wave. Only the RMS of the non-periodic sine wave without a window applied is not equal to the others.
The Flattop window has a better amplitude accuracy in frequency domain compared to the Hanning window (Figure 9). The maximum amplitude error of a Flattop window is less than 0.01%. By contrast, the Hanning window maximum amplitude error is 15%.
These maximum amplitude errors assume that amplitude correction factors are applied to the frequency spectrums. These amplitude correction factors compensate for any reduction caused by applying a window.
A Flattop window confines leakage to 3.43 spectral lines to each side of the original signal. This is a wider frequency range than the 1.5 spectral line width of the Hanning window.
Like a Hanning window, the Flattop window begins and ends with a value of zero. The center of the window has a value of one (Figure 10).
The frequency accuracy of the Flattop window is more coarse compared to a Hanning window. As a result, the Flattop window is typically employed on data where frequency peaks are distinct and well separated from each other. When the frequency peaks are not guaranteed to be well separated, the Hanning window is preferred because it is less likely to cause individual peaks to be lost in the spectrum (Figure 11).
In Figure 11, the spectrum of two periodically captured tones is shown. The tones are four Hertz apart and were captured with a one Hertz frequency resolution. The green curve has a Hanning window applied and shows two distinct tones with the correct amplitude. The blue curve has a Flattop window applied and appears to show only one tone. This is because the Flattop window creates a greater amount of frequency domain leakage than the Hanning window. Note that at the original frequencies of the tones the amplitude is correct and equal to one for both windows.
One common application for a flattop window is performing calibration. For example, a sound pistonphone only produces one single and distinct frequency during microphone calibration. In the ‘AC Calibration’ worksheet of Simcenter Testlab (formerly called LMS Test.Lab), pressing on the ‘Measurement Info’ shows that a Flattop window is being used as shown in Figure 12.
To ensure amplitude accuracy, the calibration window type cannot be changed by the user. A Flattop will always be used, even if a different window is selected for measuring.
A Uniform window has a value of 1.0 across the entire measurement time as shown in Figure 13. In reality, a Uniform window could be called “no window”. Depending on the data acquisition system used, sometimes the term “Rectangular” window is also used.
A Uniform window creates no frequency or amplitude distortion when the measured signal is periodic.
When a measured signal is not periodic, the amplitude is reduced by a maximum of 36% and the frequency content is spread over the entire bandwidth of the measurement. This is due to sharp transients that are created by repeating and appending the measured signal.
Whenever a measurement signal is periodic, a Uniform window is preferred. Applying a Hanning or Flattop window to a periodic signal will actually create amplitude and frequency distortion.
Periodic signals can include:
However, if the signal cannot be guaranteed to be periodic, a Uniform window should be avoided.
A Tukey window is very flat in the time domain, close to a value of 1.0 for a majority of the window. A ‘Taper Length’ can be specified which determines the amount of time that the window maintains a value of one (Figure 14). The lower the taper length, the longer the Tukey has a value of one over the measurement time.
Typically, Tukey windows are used to analyze transient data. The advantage of a Tukey window is that the amplitude of transient signal in the time domain is less likely to be altered compared to using Hanning or Flattop (see Figure 15). In a Hanning or Flattop window, the value of the window equals one for a shorter span compared to the Tukey window.
Typical impact events may last a few milliseconds. Examples include vibration from jackhammers, bumps in the road, or diesel engine clatter.
Exponential windows are often used in modal impact testing. They are used to ensure the accelerometer response decays to zero (Figure 16) within the measurement time to avoid leakage issues.
An exponential window always starts at a value of 1.0 at the beginning of the measurement.
The exponential decay parameter, a value between 0% and 100%, determines how much the initial value of the exponential window is reduced by the end of the measurement. For example, a decay parameter of 25% means that the window decays to a quarter of the original amplitude by the time the measurement is finished, as shown in Figure 17.
An exponential decay parameter of 100% is the same as a Uniform window (or not applying a window). When doing modal impact testing, a decay of 100% is preferred if the signal decays to zero in the measurement time frame.
When an exponential window is applied, the measured signal appears to decay more quickly than the original signal (Figure 18).
By decaying faster, artificial damping is added to the resulting measurement. Using the exponential decay parameter recorded in the data, modal curvefitters in Simcenter Testlab can remove the effects and report the correct modal damping values.
Selecting a window to match the measurement data circumstances is important to get accurate and useful data. For example, a Flattop window is ideal for performing a calibration, while an Exponential window is not appropriate.
Hopefully this article provides useful guidance on which windows to use and under what circumstances.
Additional Note on Window Correction Factors
Windows affect both the amplitude and frequency content of a signal. In this article, all spectral data had an amplitude correction factor applied. Read the knowledge base article ‘Amplitude and Energy correction factors’ to learn more about amplitude and energy correction due to windows.
Questions? Email email@example.com