I have summarized the restrictions and precautions when measuring the distortion factor (THD, THD + N) by combining WaveSpectra (hereinafter WS), sister software WaveGene (hereinafter WG), and an external oscillator.
(1) In the case of THD
Create the following two Wave files at 48000Hz, 16bit, which is common in WG. (Wave file length is appropriate) TheLet's play back the created signal with WS and see the distortion factor (THD).
Table 1
Window function | 1kHz + 2kHz | 1kHz + 3kHz |
Hanning | ||
Blackman-Harris | ||
Flat top | ||
None (rectangle) |
You can see that there is a difference depending on the window function. (Especially without the window function (rectangular window), of course, it is terrible.)
Furthermore, you can see that there is a difference between 1kHz + 2kHz and 1kHz + 3kHz.
The THD measurement of WS usually displays the ratio of the fundamental wave component (the maximum component unless otherwise specified) and the component at an integral multiple of the frequency and the RMS value is taken. increase.
Except for the case of a rectangular window where many distortion components different from the original are calculated due to the influence of the frequency response of the window function, both are around 0.08% at 1kHz + 2kHz, which is less than the original value of 0.1%. It is a value.
At 1kHz + 3kHz, the value is even lower, but of course the original value is 0.1%.
However, the Flat top window gives results close to the original value.
These are due to the influence of the window function, as well as the more fundamental reasons:
Imagine that the maximum dB value of Max in each figure is not the original -3dB (except for the Flat top window), and it is slightly different depending on the window function, and the frequency is 996.1Hz instead of 1000Hz. As you can see, the frequency resolution during FFT has an effect.
In the above case, 48000Hz sampling and 4096 points FFT, so the frequency resolution is 48000/4096 = 11.71875Hz.
Therefore, the frequency component of the 85th 11.71875 * 85 = 996.09375Hz is the maximum value when the 1000Hz signal is counted with the direct current as the 0th.
(The next 86th 1007.8125Hz is also closer to 1000Hz, but 996.09375Hz is closer to 1000Hz, so the 85th is the maximum value.)
That is, the low frequency component about 4Hz away from the original 1000Hz. Considering that the value of the frequency component is the amount passed through the bandpass filter with the width of the resolution, you can see that the dB value of Max in each figure above differs depending on the window function. ..
There is a (negative) error due to the difference in the shape of the frequency response near the center of the window function.
Furthermore, for the harmonic components, you can see that the (negative) error increases further by collecting the components at positions that are integral multiples of 996.09375Hz.
For example:
At double 2000Hz, 85 * second 11.71875 * 170 = 1992.1875Hz (deviation of about 8Hz)
At 3000Hz, which is tripled, 85 * 3rd 11.71875 * 255 = 2988.28125Hz (deviation of about 12Hz)
...etc., and the deviation from 2000Hz and 3000Hz naturally increases as the higher harmonics increase. In other words, the THD will be measured smaller than the original value
Because the values ​​that are deviated from the peak of the original frequency component and dropped will be collected .
(This is the reason why the higher harmonics are measured lower than the original value.)
By the way, in the above case, the double component is actually the 171st instead of the 170th of 85 * 2. 2003.906 It is maximal at 25Hz, and the triple component is maximal at exactly 3000Hz at the 256th instead of the 255th of 85 * 3.
In other words, the center that becomes the maximum is deviated from the integral multiple of the fundamental wave.
For the time being, using a Flat top window with a flat frequency response near the center will reduce the drop, but the easiest way to obtain accurate values ​​is to do the following when measuring in combination with the WG.
From the above, conversely, if the measurement frequency matches (is in the center) an integral multiple of the resolution of the FFT, it can be measured accurately.
In other words, it is sufficient to measure at a frequency that matches an integral multiple of the resolution from the beginning.
In other words, the sample length of the FFT is equal to exactly an integral multiple of the period of the measured signal.
In this case, the waveforms are connected at the beginning and end of the cut out part, and there is no error for that point no matter where you cut out.
(This is the case where the best result is obtained when no window function (rectangular window) is used.)
Create a Wave file in the WG as follows.
The WG has a function to easily make the frequency an integral multiple of the resolution of the FFT for such a case, and the "optimize for FFT" function, so I will use this. (Refer to the WG help for details.) The
first is a mix of
Wave1: 996.09375Hz sine wave, -3dB Wave2: 1992.187
5Hz sine wave, and -63dB
.
The second is a mix of
Wave1: 996.09375Hz sine wave, -3dB
Wave3: 2988.281 25Hz sine wave, and -63dB
.
The two should be 1kHz signals with a distortion factor of 0.1%, which have only the second and third harmonics, respectively, as in the first.
* Wave 1: 996.09375Hz sine wave is automatically converted by first setting the frequency setting combo box of Wave1 to 1000, then right-clicking the mouse and selecting "Optimize for FFT (F)". increase.
Be sure to first select 4096 by right-clicking "FFT sample count (T)" as well. (Match to FFT length in WS)
* Wave2: 1992.187 For 875Hz sine wave, right-click the mouse on the frequency setting combo box of Wave2 and select "x 2" in "Multiple of Wave1 (W)". , Will be converted automatically.
* Wave 3: 2988.28 125Hz sine wave is automatically converted by right-clicking the mouse on the Wave3 frequency setting combo box and selecting "x 3" for "Multiple of Wave1 (W)".
Since these are not automatically linked, if you change the frequency of Wave1, you need to repeat the settings of Wave2 and 3 again.
Let's play the created signal with WS and see the distortion factor.
Table 2
Window function | 996.09375Hz + 1992.1875kHz | 996.09375Hz + 2988.28125Hz |
Hanning | ||
Blackman-Harris | ||
Flat top | ||
None (rectangle) |
(This time, it is "optimized for FFT", and since the sample length of FFT is equal to exactly an integral multiple of the period of the measurement signal, there is no effect of data clipping, and the measurement is originally correct when "no window function". ← There is only one spectrum of each component)
Table 3
Window function | 100Hz + 200Hz | 100Hz + 300Hz |
Hanning | ||
Blackman-Harris | ||
Flat top | ||
None (rectangle) |
Table 4
Window function | 100Hz + 200Hz | 100Hz + 300Hz |
Hanning | ||
Blackman-Harris | ||
Flat top | ||
None (rectangle) |
You can see that the values ​​are correct.
(2) In the case of THD + N
In the case of THD + N, it should be easier to see that the window function has a large effect.(If you look at the FFT of the two components separately as shown below, you can see that the ratio of the RMS value is 60 dB, that is, THD + N is 0.1%.)
1000Hz -3dB only (RMS value -6.01dB) | White noise only (RMS value -66.01dB) |
For further comparison, I also measured THD + N with a signal of 996.09375Hz -3dB with 1000Hz "optimized for FFT".
THD + N is the value below the THD, + N display.
Table 5
Window function | 1kHz + white noise (-60dB) | 996.09375Hz + white noise (-60dB) |
Hanning | ||
Blackman-Harris | ||
Flat top | ||
None (rectangle) |
* In general cases where the measurement frequency is not "optimized for FFT", it is still larger than the original THD + N value of 0.1%. (Is the Hanning window the least error?)
(3) Number of FFT sample data
I summarized the difference depending on the number of FFT sample data.
The window function is the Hanning window. THD 0.1% is the correct value.
Table 6
number of samples | 1kHz + 2kHz | 1kHz + 3kHz |
4096 | ||
16384 | ||
65536 |
However, note that it will be different if the fundamental frequency is lower.
Below is a similar study for the 100Hz case.
You can see that the harmonics cannot be separated unless the number of sample data is increased.
However, even if it is increased, it can be seen that the THD value is not so correct due to the reason (1). (THD 0.1% is the correct value)
Table 7
number of samples | 100Hz + 200Hz | 100Hz + 300Hz |
4096 | ||
16384 | ||
65536 |
If "optimized for FFT", 4096 points will be correct.
Table 8
number of samples | 105.46875Hz + 210.9375Hz | 105.46875Hz + 316.40625Hz |
4096 | ||
16384 | ||
65536 |
summary
I have summarized what you should be careful about when measuring the distortion factor with WS.