*** Free On-Demand Webinar: Digital Signal Processing ***
Window Correction Factors
Using a window to combat the evil effects of leakage on data? That is great!
But hold on! The window itself also distorts your data as shown in Figure 1. It reduces the both the amplitude and energy of the signal.
While a window helps reduce leakage, the window itself distorts the data in two different ways:
Window correction factors are used to try and compensate for the effects of applying a window to data. There are both amplitude and energy correction factors.
Amplitude and Energy Correction Factors
To correct for amplitude or energy distortion, each spectral line of a windowed frequency spectrum are multiplied by a fixed factor. This factor is determined by the window type that was applied.
For different types of windows, different correction factors are used, as summarized in Figure 2. Only the Uniform window, which is equivalent to no window, has the same amplitude and energy correction factors.
For example, for a Hanning window, the amplitude correction factor is 2.00, while the energy correction factor is 1.63. Correction factors are applied in the frequency domain by multiplication of all the amplitude values across the spectrum.
Hanning Window Example
Take an example of a Hanning window applied to a periodic sine wave. The amplitude of a periodic sine wave is reduced by a factor of two by the window as shown in Figure 3.
It is possible to correct both the amplitude and energy content of the windowed signal to equal the original signal. However, both corrections cannot be applied simultaneously.
To correct the amplitude, for a Hanning window, all the values in the frequency spectrum are multiplied by two as shown in Figure 4.
Notice that the energy in the two signals shown in Figure 3 are now different after the multiplication by a factor of two. The amplitude corrected signal (red) appears to have more energy, or area under the curve, than the original signal (blue).
A different correction value has to be used to adjust the energy content of the signal. To correct the energy content for a Hanning window, the spectral values must be multiplied by 1.63 factor, instead of 2 as shown in Figure 5.
Now the peak amplitude values of the two spectrums do not match. Only one type of window correction can be applied at a time from a visualization point of view.
This Hanning window example used a periodic sine wave, where the effects of the window can be plainly seen. However, correction factors are applicable to non-periodic signals as well.
Simcenter Testlab
In Simcenter Testlab, under ‘Tools -> Options -> General’, the window correction behavior can be set with ‘2D Correction Mode’ as shown in Figure 6. This governs which correction mode is used in 2D Simcenter Testlab displays like the FrontBack, Bode, UpperLower, etc. The 2D correction mode default is ‘Automatic’.
The selections available for 2D correction mode are:
Another important aspect in Simcenter Testlab of window correction modes is RMS calculations. When RMS calculations are performed in Simcenter Testlab, energy correction is automatically applied to get the correct RMS value. This conversion to energy correction values is done even if the spectrum is being displayed with amplitude correction.
A RMS value can be calculated by right clicking in the display and selecting ‘Add Double Cursor -> X’. Right click on the cursor and select ‘Calculations -> RMS’. For more information, see the ‘Double X Cursor Knowledge Base article’.
The amplitude corrected spectrums in Figure 7 appear to have different ‘areas under the curve’, but the RMS calculation values are the same.
The RMS values between the cursors are identical. To calculate RMS consistently, the Simcenter Testlab software changes the spectral data to energy corrected values during the calculation, even if they are displayed with amplitude correction.
Naturally, if the spectral data is energy corrected, the RMS values are also identical as shown in Figure 8.
RMS calculations can be used to get consistent values from windowed data.
Conclusions
A summary of the main points in this article:
Note: In this article, a periodic sine wave was used as an example. Window corrections are equally applicable to non-periodic signals.
Questions? Email peter.schaldenbrand@siemens.com or contact Siemens PLM GTAC support.
Related Links
Is there any theory formula about how to calculate the window correction factors show in figure 2?
The correction factors are well documented in any Digital Signal Processing book or via a Google search. There is more information located in the Theory documents provided with LMS Test.Lab. Look in the Signal Processing.pdf file located in C:\Program Files (x86)\LMS\LMS Test.Lab {version}\central\Help\Theory documents PDF.
For even more information if you are located in North America, we offer an excellent 4 day Digital Signal Processing course taught by Professor Chuck Van Karsen from Michigan Technological University. We offer that course in March and October this year.
I was looking for the flat top window correction factor and also ended up here (btw, I'm a LMS/Simcenter user, but am currently working on a project in Python). I am using the flat top window which is built into the scipy library and when using the window correction factor of 4.18 as listed above, I end up at an estimated FFT amplitude of 90% of the actual amplitude. When using a correction factor of 4.18/0.90=4.64 I logically end up with the correct amplitude.
When searching Google a bit and playing around a bit I used the following formula to get the correction factor
correction_factor =max(w)/mean(w)
where w is the vector which contains the weighing factors of the window.
After this I calculated the weighing factors of the flat top window by using the formula found on wikipedia and put them in a Python script to calculate the correction factors. Note that the shape of the flat top window depends on the values of alfa 0-4. I have used the values on the wikipedia page. The script also includes the calculation for the Hann window. The script calculates a correction factor of 4.64 for the flat top window and 2.0 for the Hann window. So, the Hann value corresponds to the table but the flat top one doesn't. Maybe that was also the underlying question from @RoyDuan.
So, are the alfa parameters used in LMS/Simcenter different from the parameters shown on the wiki page? Both the alfa values as found on wiki as another source (scipy library) result in a different correction factor than shown here. I think most people who are looking for the correction factor and don't know how to calculate it end up on this page and when looking in more detail think the factor shown in the table is wrong, for example here. More important, I would be happy if someone could confirm whether the actual implementation in the software is correct (is 4.64 used or do you use different alfa values, or is there another reason?) as this effects my (and other people's) measurement results.
import numpy as np import matplotlib.pyplot as plt N = 1000 n = np.array(range(N)) # Hann window hann = 0.5*(np.ones(N)-np.cos(2*np.pi*n/(N-1))) cor_hann = 1/(np.mean(hann)/max(hann)) # Flat top window a0 = 1.0 a1 = 1.93 a2 = 1.29 a3 = 0.388 a4 = 0.028 flattop = (a0*np.ones(N) - a1*np.cos(2*np.pi*n/(N-1.0))+ a2*np.cos(4*np.pi*n/(N-1.0))- a3*np.cos(6*np.pi*n/(N-1.0))+ a4*np.cos(8*np.pi*n/(N-1.0))) cor_flattop = max(flattop)/np.mean(flattop) # Output plt.plot(n, hann, n, flattop) plt.legend(['Hann', 'Flat top']) print('Hann correction factor is {:0.2f}').format(cor_hann) print('Flat top correction factor is {:0.2f}').format(cor_flattop)
There is not a single definitive standard for the coefficients of a flattop window.
The coefficients used in Testlab are shown below: