THD Calculation

Talevy

Registered
Thread Starter
Joined
Aug 16, 2022
Messages
6
Hello,
I would appreciate an explanation of the THD calculation
For example: for 2 harmonics only, I get the values:
H1 = 42.1 SPL
H2 = 77.1 SPL
THD = 0.241%

Can you please share the formula for the calculation?

Thank you
 

Talevy

Registered
Thread Starter
Joined
Aug 16, 2022
Messages
6
Thank you for the answer,
I gave an example of a calculation using 2 harmonics only to understand the formula and still can't figure it out.

I Would appreciate help-
Does the algorithm consider the energy at the harmonic frequency only or also at frequencies around it?
How is the division into time windows done in THD measurement for sweep sine?

Thanks
 

John Mulcahy

REW Author
Joined
Apr 3, 2017
Messages
5,833
I am unable to understand what your example figures are supposed to mean. Is H1 mean to be the fundamental? Why would the 2nd harmonic be 35 dB higher than the fundamental? The figures look nonsensical.

How is the division into time windows done in THD measurement for sweep sine?
Not sure what you are asking, but there is an explanation of how the distortion images are extracted from the deconvolved impulse response in Transfer function measurement with sweeps.
 

Talevy

Registered
Thread Starter
Joined
Aug 16, 2022
Messages
6
Thank you John.

1. I am sorry for the confusion, here is another example:
H = [84.8190 43.6400 34.9430 34.1940 38.1570 31.1410]; (Fundamental, H2, H3.. H6 in SPL)
Can you please share the formula you used to calculate the THD (REW result: 0.513% for the calculation with 6 harmonics)?

The known formulas:

sqrt(sum(H(2:end).^2))/H(1) -> result: 0.9665
or
sqrt(sum(H(2:end).^2))/sqrt(sum(H(1:end).^2)) --> result: 0.6950

2. In the distortion figure, do you show the IR of each harmonic? Or is an additional operation performed on the IR of each harmonic? And if so, what exactly?


Thanks for your help.
 

John Mulcahy

REW Author
Joined
Apr 3, 2017
Messages
5,833
If you want me to comment on an REW result attach the mdat file.

Distortion calculations are carried out on linear magnitudes, not dB SPL.

The distortion graph shows distortion vs frequency, the distortion images are FFT'd and plotted scaled in frequency according to their order so that they align with the corresponding fundamental frequency.
 

Talevy

Registered
Thread Starter
Joined
Aug 16, 2022
Messages
6
The exmplae above is for 27.281Hz but i'm asking in general
 

John Mulcahy

REW Author
Joined
Apr 3, 2017
Messages
5,833
Your 0.513% figure comes from the option "Use harmonic frequency as ref". If you deselect that you will get a figure of 1.10%, which is the answer you should also get if you perform the calculation manually using the 27.281 Hz data. The effect of Use harmonic frequency as ref is explained in the help:
The harmonic and THD plots in normalised mode use the level at the fundamental for each frequency as their reference by default - for example, the distortion figures for each harmonic at 1 kHz will depend on the level of the fundamental at 1 kHz. If Use harmonic frequency as ref is selected the reference will be the frequency of the harmonic - for example, at 1 kHz the 2nd harmonic figure will depend on the level of the fundamental at 2 kHz, the 3rd harmonic will depend on the level of the fundamental at 3 kHz and so on. This follows a recommendation made by Steve F. Temme in "How to graph distortion measurements" presented at the 94th AES convention in March 1993. If the response of the system being measured is flat this makes no difference to the results, but when the response is not flat (as for most acoustic measurements) it can remove the influence of the loudspeaker's fundamental response from the distortion figures. As an example, suppose the loudspeaker response was flat apart from a 6 dB peak at 2 kHz. 2 kHz is the 2nd harmonic of 1 kHz, so the 2nd harmonic level shown at 1 kHz will be increased by 6 dB due to the boost in the fundamental when using the excitation frequency as the reference. Similarly the 3rd harmonic level at 667 Hz (2/3 kHz) will be boosted by 6 dB. If the harmonic frequency were used as the reference the distortion figures would not show this boost. Using the harmonic frequency as the reference also provides a more meaningful view of distortion at frequencies below the LF roll-off of the system as otherwise the distortion levels are boosted as the level of the fundamental drops. Note that this option will not affect the traces when the plot is not normalised, but will still affect the values in the legend if the distortion figures are set to read in percent or in dB relative to the fundamental.
A google search should turn up a copy of the paper referenced.
 

Talevy

Registered
Thread Starter
Joined
Aug 16, 2022
Messages
6
Thank you very much, you helped a lot.
One last question please -
According to the paper you sent, windowing is needed on the impulse response to isolate the IR for each harmonic. How did you choose the initial window size?
 
Top Bottom