Windows and Leakage
Spectral leakage is a problem that arises in the digital processing of signals. Leakage causes the signal levels to be reduced and redistributed over a broad frequency range, which must be addressed in order to analyze digital signals properly.
This article explains what causes leakage, what it looks like, and how to use windows to mitigate the effects of leakage by smoothing signal in the time domain before performing a Fourier Transform.
Example with Sine Wave
Take an example with a sine wave. Suppose your analyzer is setup to perform a Fast Fourier Transform (FFT) that will result in a 1 Hz frequency resolution as shown in Figure 1. The frequency resolution setting means that the computer can display only every 1 Hz.
The following can be observed from Figure 1:
Because data cannot be displayed at 2.5 Hertz, the 2.5 Hertz signal will leak from zero Hertz to the full bandwidth as shown in Figure 2. This might be surprising, as intuitively one might guess that the spectral leakage would be confined to the adjacent frequency lines.
A signal with leakage (green in Figure 2) has lower amplitude and a broader frequency response than a signal with no leakage (red in Figure 2). This makes it difficult to quantify the signal properly in the frequency domain.
Why does leakage effect the entire frequency range? It has to do with whether or not the signal is periodic relative to the measurement time frame.
A periodic signal has certain characteristics. Consider the measurement in Figure 3.
A measurement of a sine wave is performed. Notice that only a small amount of the original sine wave signal was captured, based on the framesize specified for the acquisition. This is called the ‘captured signal’ in Figure 3.
The ‘captured signal’ is then repeated and appended end to end, which is called the ‘repeated signal’ in Figure 3. If the repeated signal looks like the original sine wave, then the captured signal is periodic.
Why copy the captured signal repeatedly? This is due to the interval of the integration on the Fourier Transform (Equation 1) which the FFT is based upon:
The interval of the integral goes from negative infinity to positive infinity, so the small snippet must be repeated to satisfy this equation.
So the FFT algorithm takes the small amount of captured data and repeats it, in order to perform the Fourier Transform and produce a frequency spectrum. It assumes this signal repeats for all time before, and all time after.
In this case, the signal is periodic, and the resulting frequency spectrum will have no leakage.
Just by changing the measurement time a small amount, the captured signal is not periodic, as shown in Figure 4.
There are sudden transitions at the end of each captured signal. These sharp transients, circled in red in Figure 4, have a broad frequency response. Short transient signals in the time domain produce high, broadband frequency content as shown in Figure 5.
So the resulting spectrum will have broadband response as well as a sinusoidal response as shown in Figure 6 in green.
Quite often a measurement signal is not periodic with the acquisition time. A running motor or pump does not normally produce frequency content that is an exact integer multiple of the measurement time. The motor or pump operation is not influenced by the acquisition settings.
In controlled experiments, like a modal analysis with a shaker, a measurement can be synchronized with a source to eliminate leakage.
Because the vast majority of measurements will have non-periodic signals, the question is how to minimize leakage in these cases?
To reduce leakage, a mathematical function called a window is applied to the data. Windows are designed to reduce the sharp transient in the re-created signal as much as possible.
Windows are typically shaped as functions that start at a value of zero, move to a value of one, and then return to a value of zero over one frame. The captured signal is multiplied by the window as shown in Figure 7.
The windowed signal is then repeated and appended and shown in Figure 8. Notice that the sharp transients are eliminated (circled in gold) and smoothed out, even though the repeated signal does not match the original signal.
Because the sharp transients are reduced and smoothed, the broadband frequency of the spectral leakage is also reduced.
Benefit of Reducing Leakage
Why go through the trouble of multiplying the signal by a window if it does not match the original signal?
The benefit is not that the captured signal is perfectly replicated. The main benefit is that the leakage is now confined over a smaller frequency range, instead of affecting the entire frequency bandwidth of the measurement.
The improvement of this reduced frequency range for the leakage is shown in Figure 9.
With the leakage spread over a smaller frequency range, doing analysis calculations like RMS yields more accurate results.
In LMS Test.Lab, double X cursors can be used to calculate RMS. Because spectral leakage is reduced, it is easier for an operator to place the cursors over a narrower frequency range.
In Figure 10, it is impossible to calculate the proper RMS amplitude estimate from the double X cursor over a limited frequency range of the un-windowed sine wave, since the leakage is over the full frequency range. Therefore the RMS amplitude is not correct.
In real life measurements, there are often many different frequencies present. Without a window being applied, these frequencies would leak into each other, making determining the true amplitude of individual peaks very difficult, if not impossible. In Figure 11, the leakage of two tones with and without a window are overlaid.
In the case of two closely spaced sine tones, the window makes it easier to separate and distinguish each tone so a proper analysis could be performed.
There are many different windows, each optimized for a particular situations. Some windows include:
Depending on the measurement situation, the appropriate window can be applied.
Spectral leakage is a challenge in digital signal processing, which can be addressed by applying windows:
Questions? Contact us!
Note: Because windows alter the amplitude and frequency content of a signal, there are ‘correction factors’ which are applied to compensate for the changes created by applying the window. In this article, amplitude corrections were used in the frequency spectrum graphs. There is more information about correction factors in the ‘Window Correction Factors’ knowledge base article.