• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). There are daily reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

THD and IMD Measurement: Do they represent the actual nonlinear distortion?

OP
Pinox67

Pinox67

Member
Editor
Joined
Apr 8, 2020
Messages
71
Likes
145
Location
Italy
Only in pathological cases, which is what your examples are all about. When comparing two amplifiers, one decent and one pathological, the difference you reported is totally irrelevant, since the standard THD values are already two orders of magnitude (or more) apart. It's called "engineering", you know; engineers know when to ignore second order effects.

If there are substantial differences in values, yes, I agree, this discrepancy is second-rate.

But if the THD and/or IMD values of two amplifiers are comparable, let's say they differ by less than 10dB, you can't tell if in fact one is better than the other if you don't know the order of the distortions that caused them, since the mistake you make depends on them. In other words, a classification based on THD or IMD loses some meaning. Even the SINAD, which should take into account all the different energy components, is missing pieces.
Anyway, these numbers are not the most important aspects to me: it is much more interesting to observe the distribution of energy among the harmonics to understand the sound quality of a device.
 
Last edited:

lashto

Addicted to Fun and Learning
Forum Donor
Joined
Mar 8, 2019
Messages
781
Likes
420
Why should a component at the same frequency as the input be considered a distortion?
If it was not there to start with, then it's distortion. And it's also HD because technically it's the first harmonic. I'd say that's more than enough reason to put it in the THD formula.

Or just create a new formula and call it TrueHD/FullHD/whatever. If you manage to convince amirn to add it to the standard measurements @Pinox67, you have all my upvotes. Which is a grand total of one :)
With the "classic" THD in the -120Db area, that measurement is becoming even more meaningless. We surely need some innovation in the measurements area. The new stuff might just be too good for 1950 metrics (or whenever that measurement was created).
 
OP
Pinox67

Pinox67

Member
Editor
Joined
Apr 8, 2020
Messages
71
Likes
145
Location
Italy
If it was not there to start with, then it's distortion. And it's also HD because technically it's the first harmonic. I'd say that's more than enough reason to put it in the THD formula.

Or just create a new formula and call it TrueHD/FullHD/whatever. If you manage to convince amirn to add it to the standard measurements @Pinox67, you have all my upvotes. Which is a grand total of one :)

The main problem is that in the measurements the new harmonics are compared with the fundamental harmonics of the output signal from the device, not with those of the input signal, which can be at a different level. So, from the measurements you can't detect HD1 directly. I have suggested a method in the post#23 to derive HD1 indirectly for memoryless systems; it should be extended to more general cases of memory systems, much more complex...

With the "classic" THD in the -120Db area, that measurement is becoming even more meaningless. We surely need some innovation in the measurements area.

Yes, with very low THD/IMD values, the listening effects of a few more dB are not relevant. It should only be taken into account in the comparisons between different devices that each value has a modest margin of uncertainty.

The new stuff might just be too good for 1950 metrics (or whenever that measurement was created).

If you have read the thread already given, I am carrying out studies on the effects of non-linear distortions on transients, therefore on the signal in the time-domain, a field that I think is a bit neglected. I have defined new statistical indicators that could be useful in explaining some effects on perception. Work in progress…
 
Last edited:

lashto

Addicted to Fun and Learning
Forum Donor
Joined
Mar 8, 2019
Messages
781
Likes
420
If you have already read the thread already given, I am carrying out studies on the effects of non-linear distortions on transients, therefore on the signal in the time-domain, an aspect that I think is a bit neglected. I have defined some statistical indicators that could be useful in explaining some effects on perception. Work in progress…
Yes I did read your posts, very interesting stuff IMO. I am not an EE and my math is too rusty to fully understand what you do. But even so, it looks to me that you are going the right direction. So good luck and godspeed with your experiments!
 

mansr

Major Contributor
Joined
Oct 5, 2018
Messages
4,690
Likes
10,544
Location
Hampshire
If it was not there to start with, then it's distortion. And it's also HD because technically it's the first harmonic. I'd say that's more than enough reason to put it in the THD formula.
How do you differentiate this "first harmonic distortion" from gain/attenuation? Why should it matter?
 
OP
Pinox67

Pinox67

Member
Editor
Joined
Apr 8, 2020
Messages
71
Likes
145
Location
Italy
[EDIT Thu 1 Dec, 2022]
In my studies I have developed models for more general cases of nonlinear systems with memory effects, more representative of real audio amplifiers. Won by curiosity, I have also investigated the trend of THD and IMD also for these cases, deriving a method to indirectly estimate the HD1 and then correct their values.​

THD and IMD calculation in dynamic nonlinear systems

We broaden the previous study by addressing the more general case of dynamic nonlinear systems, in which memory effects occur. These systems are able to simulate both linear (the classic changes of magnitude and phase of frequency response) and nonlinear effects, that is, the appearance of new harmonics and related intermodulation products generated by the nonlinear interactions of the tones present in the source signal. In this respect they differ from static systems (without memory) in that in these the magnitudes of distortions are frequency-independent and can only take two predefined values in the phases. Dynamic systems remove both of these limitations. A ‘black-box’ model like that of Volterra-Hammerstein allows you to describe its behavior well when the nonlinear effects are small (< 1%), therefore close to the reality of good audio amplifiers.

Briefly, the system is modeled as the sum of input signal processing by n streams. Each one models the contributions of i-order distortion, and is composed of two cascading parts. The first is constituted by the application of a function (always a polynomial of degree i) to the signal that models the nonlinear part; the second part instead models the memory effects through a "classic" linear time-invariant (LTI) system. The diagram, limited for simplicity to the modeling of the 2nd and 3rd harmonic only, is as follows:
fig 6 - Hamm Model.png

Fig. 6 – Hammerstein-Volterra model, for 2nd and 3rd order distortions.

The output y(t) relative to the input x(t) can be calculated using the following formula:
cap1.png

Where '*' represents the convolution operation and the hi(t) functions represent the Kernel, with the following meaning:
  • h1(t): impulsive response of the system, dual of the classic frequency response H1(f) of the system.
  • h2(t), h3(t): impulsive responses respectively relating to the 2nd and 3rd order distortion associated with the relative harmonics.
To focus on the main aspects in the following simulations H1(f) is chosen so that it is unitary on all frequencies, while H2(f) and H3(f) (the transforms of h2(t) and h3(t)) are calculated so as to create the 2nd and 3rd harmonic distortions with the desired magnitude and phase values, constants over all bandwidth. This is due to real amplifiers with wide bandwidth and constant distortions in audio band (not unusual situation).

With these hypotheses we start by studying the behavior of 2nd order distortion when it varies its phase on a signal with a single tone. In static systems HD2 is -90 degrees compared to fundamental when positive and +90 degrees when negative. Since the 2nd order distortion is composed of DC+HD2, even if HD2 is out of phase, the DC will not undergo any change (it is a real value). So for the 2nd order we will only have a translation in time of the distortion curve, as reported in fig. 7 for some phase shift values.​

fig 7 - Dist 2nd.png

Fig. 7 – Source tone (first track) and 3rd order distortion component amplified for phase by steps of -90, -45, 0, 45 and 90 degrees (upper tracks from above).
For the 3rd order distortion, more interesting things happen. We have seen that in static systems HD3 is 180 degrees compared to fundamental when positive (with expansive effect) and 0 degrees when negative (with compressive effect). Since the 3rd order distortion is composed of HD1+HD3, if HD3 is out of phase, HD1 will also be affected by the same phase shift (we assumed constant H3(f) in magnitude and phase). Since HD1 and HD3 have different frequencies, a phase shift of the same amount will cause a change in the waveform over time (to observe only a translation over time it is necessary that the phase shifts are in the same ratio of the frequencies of the tones, here 1:3). Figure 8 shows the waveform of the distortion when the HD3 phase assumes 180, 135, 90, 45, and 0 degrees. Of course these translations alter the resulting curve over time.​

fig 8 - Dist 3rd.png

Fig. 8 – Source tone (first track) and 3rd order distortion component amplified for phase by steps of 180, 135, 90, 45, and 0 degrees (upper tracks from above).

The following curve shows the phase shift of HD1 compared to HD3 and the ratio between the magnitudes.​

fig 9 - HD1.png

Fig. 9 – HD1/HD3 magnitude and HD1 phase for a single tone, HD3 = -60dB, depending on its phase.

The graph essentially tells us that when the HD3 phase changes, the HD1 contribution to the fundamental is constant in the magnitude but has a variable phase that depends linearly on it. This causes alterations to the fundamental harmonic that still remain small. To get an idea, the following figure shows the changes in module and phase of the fundamental when HD3 assumes a high value, -40dB (THD = 1%).​

fig 10 - H1 Shift.png

Fig. 10 – Magnitude and phase variations of H1+HD1/HD1 for a single tone, HD3 = -40dB, depending on its phase.

The trend is of a sinusoidal type. We observe that:
  • When the phase changes, the fundamental will undergo amplitude changes of ±0.25dB while; by performing some calculations, the phase changes determine a group delay in low frequency that can reach an excursion of ±0.2ms (not very far from what is believed to be the threshold of hearing); for HD3 = -60dB (THD = 0.1%) these values are reduced by 10 times.
  • The frequency of the tone is irrelevant, as we have assumed that the phase of distortion is independent of it. If this is not true we will also have HD1 variable with the frequency and therefore, in the presence of complex signals each of the component tones will be altered in magnitude and phase of different values (even if low, as described in the previous point), despite the level of the 3rd harmonic is constant throughout the audio band.
What is described results in saying that the phase changes introduced by dynamic systems in 2nd and 3rd order distortions do not cause appreciable changes in the value of THD. It follows that we can go back to what has already been studied in the case of static systems, where the ‘error’ in the calculation of the THD, due to not considering HD1, depends only on the ratio of the level of distortions of 2nd and 3rd order. The values to be applied can be found in the graph in fig. 2, calculating the difference between the True-THD and THD curve (up to about 10dB, when the 3rd harmonic is predominant).

For classic intermodulation tests (IMD) with two-tone tests the situation gets complicated, but not too much. The ‘luck’ is due to the fact that the two tones used in the tests generate distinct intermodulation products for 2nd and 3rd order of distortion, as shown in the figures below for the SMPTE and CCIF tests.​

fig 11 - SMPTE.png

Fig. 11 – Simulation of the SMPTE test (two tones at 60Hz and 7KHz in a ratio of 4:1), with HD2 = HD3 = -40dB.

fig 12 - CCIF.png

Fig. 12 – CCIF test simulation (two tones at 19KHz and 20KHz in 1:1 ratio), with HD2 = HD3 = -40dB.

There is no overlap between the harmonics created by the two orders of distortion: each set is in its own and therefore a possible change in the phases of distortions does not cause alterations in the level of any harmonic. As a result, the IMD test will also be independent of the 2nd and 3rd order distortion phases. Here too, this does not imply that these do not have impacts on the resulting curve in time.

The summary of the above is shown in Figure 13, which shows the extent of the corrections to be applied to THD and IMD for the SMPTE and CCIF tests as a function of the ratio of the distortion level between 3rd and 2nd harmonic, considering the entire spectrum. The distortion values are calculated on the signal in the time domain (for Parseval's theorem, the result is equivalent to the classical one calculated in the frequency domain), still by the simulator of fig. 6. We remind that the extent of the correction does not depend on the absolute level of distortions.​

fig 13 - Corr.png

Fig. 13 – THD and IMD test correction according to HD3/HD2 ratio.

Therefore, even in the more general case of dynamic nonlinear systems, the contributions of 3rd order distortion to the fundamental (HD1) remain, resulting in variable errors in THD or IMD if taken as a measure of the extent of the overall distortions introduced by the non-linearities of a system. These errors are negligible (below 1dB) as long as HD3 is at least 15dB lower than HD2.

Strictly speaking, to complete the picture we should also include higher-order distortions in the analysis. In this more general case the models tell us that the order of distortion i-th is composed of the harmonics of order i, i – 2, i – 4, and so on. Thus, the harmonics of the highest orders will ‘interfer’ with those relating to the lowest orders. The classic measurements of THD and IMD already measure all this by referring to harmonics, again with the exception of the HD1 component, which is affected by all odd order distortions. The model described in fig. 6, extended to the highest orders, makes it possible to trace the magnitude of HD1, and thus the corrections to be made to THD and IMD for any value of the phase shift. Unfortunately, the results cannot be summarized in simple graphs, given the number of variables in play: the same calculations as the simulator must be performed. To get an idea of the complexity and extent of the quantities involved, the following graphs illustrate what happens to HD1 (similar to the graph in fig. 9) in the presence of distortions of even the 4th and 5th order as the phase of HD3 varies and HD5/HD3 ratio (HD2 and HD4 do not affect graphics). The first graph shows the HD1 module, where the 0dB reference is compared to the situation where the 4th and 5th order are not present; the second reports HD1 phase.​

fig 14 - HD5 Mod.png

Fig. 14 – Amplitude impacts on HD1 per HD3 phase and HD5/HD3 ratio.

fig 15 - HD5 Phase.png

Fig. 15 – HD1 phase per HD3 phase and HD5/HD3 ratio.

It is evident that the trend is not exactly monothonic and with no small oscillations. Fortunately, in most real amplifiers under normal working conditions the harmonics of the 2nd and 3rd harmonic distortions are predominant over the others (20dB or more), so the contribution of the higher harmonics cause negligible impacts to the graph of fig. 13.​
 
Last edited:

kongwee

Addicted to Fun and Learning
Joined
Jan 22, 2022
Messages
778
Likes
195
More interest how non linear harmonic distortion occur in the real world transistors.
 

syn08

Senior Member
Joined
Aug 9, 2019
Messages
314
Likes
373
Location
Toronto, Canada
In my studies I have developed models of the most general case of systems with memory effects. Won by curiosity, I have also obtained some graphs on the trend of the THD and the IMD even for these more general cases, summarized below.​

THD and IMD in systems with memory

In general, even systems with memory, when stimulated by a single tone, create multiple harmonics in their output. Unlike the memory-less system, here the harmonics also depend on frequency, level and with any phase. ‘Black-box’ models such as Volterra-Hammerstein allows us to describe their behavior well when the non-linear effects are small (< 1%). In short, the system is modeled as the sum of the input signal processing by n streams. Each shapes the contribution of the distortion of order i, and is composed of two parts. The first consists of a polynomial of degree i, which models precisely the non-linear part; the second part instead shapes the memory effects through a ‘classic’ linear time-invariant (LTI) system. The scheme, limited for simplicity to the modeling of only 2nd and 3rd harmonics, is as follows:
View attachment 245156
Fig. 6 – Hammerstein-Volterra model, for 2nd and 3rd order distortions.

From a computational point of view it is convenient to use the in the frequency domain, where the expression of the output Y(f) can be written as follows:​


The Hi(f) transfer functions represent the Kernel, with the following meaning:​
  • H1(f): ‘classic’ frequency response of the system.
  • H2(f), H3(f): system frequency responses attributable to the only effects of 2nd and 3rd order distortion.
To focus on the main aspects in subsequent simulations H1(f) is chosen so that it is unitary on all frequencies, while H2(f) and H3(f) are calculated so as to return in output the desired module and phase values of the 2nd and 3rd harmonic, constants throughout the frequency band.

With these hypotheses we study what happens to the HD1 component, “hidden” in the original signal, when HD3 changes the phase, from -180 to 180 degrees, for a single tone. The level of HD3 is constant at -60dB, but even here the graph is invariant with respect to the absolute values of the distortions.​

View attachment 245157
Fig. 7 – HD1/HD3 magnitude ratio and phase of HD1 for a single tone at 1KHz, HD3 = -60dB, depending on its phase.
The graph shows:
  • In blue: ratio between HD1 and HD3. For 0 and 180 degrees of HD3, typical of a memory-less system, we have a difference of 9.54dB, as already seen. For the other intermediate values the ratio decreases, with a minimum at 0dB for -90 and +90 degrees. Hence, HD1 never disappears.
  • In orange: HD1 phase compared to fundamental. For 0 and 180 degrees we have that HD1 is respectively in out of phase and in phase with respect to the fundamental. For other values there is a gradual transition between the two values, with more significant variations around +/-90 degrees. This therefore implies mixed compressive and expansive effects on the signal.
These trends determine the THD calculation "errors" shown in the following figure.​

View attachment 245160
Fig. 8 – Legacy-THD and True-THD for a single tone at 1KHz, HD3=-60dB, depending on its phase.

In red the value of the classic THD, always equal to -60dB (= HD3). In green the value of the True-THD that also takes into account HD1. It is evident that THD is underestimated, for values ranging between about 10dB (for HD3 phases of 0 and 180 degrees) and 3dB (for phases +/-90 degrees). Both THD values are calculated on the signal in the time domain instead of the frequency.

Let's now analyze what happens when the 2nd order distortion also appears, which generates as an additional component only the DC, which is always overlooked. The following graph shows the difference between True-THD and THD where a dimension is added that identifies the level of the 2nd harmonic with respect to the 3rd.​

View attachment 245183
Fig. 9 – Ratio between True-THD and classic THD for a 1KHz tone, depending on the HD3 phase and the ratio of HD2 and HD3 levels.

As long as 2nd harmonic prevails in the front of the graph, with HD2/HD3 = 50dB, there is no difference in THD for any phase value of HD3. When HD3 grows, and is about 32dB lower than HD2, the difference between THDs begins to be felt, and then settles on the curve of fig. 8 around HD2/HD3 ratios of -23dB. To add that the graph is independent of the phase of the 2nd harmonic.

The trend is also similar for the IMD. The following graph shows the difference between True-IMD and the classic one in the CCIF Test (2 tones at 19KHz and 20KHz at the same level), depending on the same variables. The principal difference is in the discrepancies in the presence of the 3rd harmonic, reduced in the maximum and minimum values to 5.6dB and 2.0dB respectively.​

View attachment 245184
Fig. 10 – Ratio between True-IMD and classic IMD for CCIF Test, depending on the HD3 phase and the ratio of HD2 and HD3 levels.

Therefore, even in the more general case, the contributions of the 3rd order distortion to the fundamental subsist, resulting in not exactly small variable errors in the THD and in the IMD as a measure of the extent of the overall distortions introduced by the non-linearities of a system. These errors are negligible as long as HD3 is absent or at least 10dB lower than the 2nd harmonic. Strictly speaking, even odd orders higher than the 3rd can make contributions to the fundamental, increasing the discrepancy. As is generally the case in good amplifiers, they are of a much lower level than the 2nd and 3rd harmonics, and therefore of negligible effect.​

Again, not sure what you are trying to show here; a memoryless system (also called static system) has the output at any time depending only on the value of the input at the same time. A continuous time system is memory less if its unit impulse response h(t) is zero for t≠0. These memory less LTI systems are characterized by y (t) =Kx (t) where K is constant.

A system with memory (also called dynamic system) has the output at any time depending on the value of the input and the value(s) on previous time(s) (not discussing causality here). Perhaps one of the simplest dynamic system in electronics is an integrator; dynamic systems necessary have an energy storage device embedded (e.g. a capacitor).

Assuming causality, there is virtually no difference in mathematically handling static or dynamic systems. I can barely think of a pure static system in electronics, though, and I am not aware of any special handling requirement for these. Separating the transfer function in a linear part and a small perturbation representing the nonlinearities up to a certain order is a standard approach in circuit analysis; you appear to be back to a previous posting, where you now consider the phase of a harmonic component as having an impact on the fundamental and other harmonic components. While this is strictly mathematically true, what I said above in #38 and #40 still holds. Pathological cases are not of much interest in audio electronics, and, if you don't like the THD metric, then don't use it and propose another synthetic indicator.

But if you are trying to write some sort of academic dissertation, then you are on the right track, although I see little original results here.
 
OP
Pinox67

Pinox67

Member
Editor
Joined
Apr 8, 2020
Messages
71
Likes
145
Location
Italy
More interest how non linear harmonic distortion occur in the real world transistors.

Transistors have an exponential transfer function. In one section of this post I looked at what happens in these cases. It must be said that the resulting distortions heavily depend on the type of circuit in which the active elements are inserted so that, for a "black-box" modeling, one can only study the trend of the distortions. Typically, in good amplifiers of any kind, low-order ones are always predominant, with the effects just discussed.
 
Last edited:
OP
Pinox67

Pinox67

Member
Editor
Joined
Apr 8, 2020
Messages
71
Likes
145
Location
Italy
Again, not sure what you are trying to show here; a memoryless system (also called static system) has the output at any time depending only on the value of the input at the same time. A continuous time system is memory less if its unit impulse response h(t) is zero for t≠0. These memory less LTI systems are characterized by y (t) =Kx (t) where K is constant.

A system with memory (also called dynamic system) has the output at any time depending on the value of the input and the value(s) on previous time(s) (not discussing causality here). Perhaps one of the simplest dynamic system in electronics is an integrator; dynamic systems necessary have an energy storage device embedded (e.g. a capacitor).

Assuming causality, there is virtually no difference in mathematically handling static or dynamic systems. I can barely think of a pure static system in electronics, though, and I am not aware of any special handling requirement for these. Separating the transfer function in a linear part and a small perturbation representing the nonlinearities up to a certain order is a standard approach in circuit analysis; you appear to be back to a previous posting, where you now consider the phase of a harmonic component as having an impact on the fundamental and other harmonic components. While this is strictly mathematically true, what I said above in #38 and #40 still holds. Pathological cases are not of much interest in audio electronics, and, if you don't like the THD metric, then don't use it and propose another synthetic indicator.

But if you are trying to write some sort of academic dissertation, then you are on the right track, although I see little original results here.

Thanks for the detailed integration to the description of static and dynamic systems, I appreciate your accuracy. I updated the nomenclature in the post for more clarity.

The model described in the post is certainly not original, it is widely used to model non-linear systems with memory and for this reason it is also a guarantee that it represents our reality of interest well. The part that I have not found described in other texts and therefore original is related to the effects of non-linear distortions on the tones of the source signal (HD1), neglected as they are hidden in the source tones themselves.

I resorted to this model because more than one person pointed out to me (but I also noticed it in my measurements) that it doesn't often happen that an amplifier behaves as expected by the nonlinear static model of the initial post. I mean that the distortions do not occur, even if they are constant in magnitude in the audio band, with phases equal to the +/-90 values for the 2nd harmonic and 0/180 for the 3rd. This means that the static model is not sufficient, and the introduction of memory effects are able to relax all these constraints.

In the last post, I therefore explored what happens in more general cases to HD1 and hence the way in which it can be estimated from the classic distortion measurements for a pure tone. Thus, there is only the intention to extend the study described in the first post valid for few classes of systems to broader classes that better describe the behavior of real amplifiers. If then all this will give rise to a correction of the THD and IMD (or to a new indicator), I am certainly not the one to decide; surely those who use these indicators will certainly have the elements to understand if and how much they leave out, in order to be able to correctly compare systems with THD and IMD values close to each other.
 
Last edited:
OP
Pinox67

Pinox67

Member
Editor
Joined
Apr 8, 2020
Messages
71
Likes
145
Location
Italy
A friend pointed out some problems to me in the post#46 about dynamic model simulations. On a later review of the model implementation, I indeed found a calculation error that skewed some results. So I rewrote most of the post, making the necessary corrections. The conclusions are no so different from those exposed at the time, and in fact the situation is simpler. Forgive the mistake.
 
Last edited:
Top Bottom