**[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 other indicators also for these cases, deriving a method to indirectly estimate the HD1 and then correct their values.

*Measurement of distortions in dynamic nonlinear systems*

We extend what has been described in the first post by addressing the more general case of dynamic non linear systems, where memory effects also occur. In practice, these effects translate into the dependence of the modules of the non linear distortions not only on the level but also on the frequency of the tones; moreover, also the phase can depend on both variables (in reality the requirement of causality, i.e. of feasibility in the analog field, determines the relationship between module and phase). A *black-box* model such as that of Volterra-Hammerstein allows us to well describe its behavior when the non-linear effects are small (< 3%), in line with the reality of 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 – 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:

Where '*' represents the convolution operation and the h

*i*(*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, when in the steady-state. The filters thus defined will be acausal, but valid for the following considerations.

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 – Source tone (first track) and 2nd 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 – 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/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 – 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:

- As the phase varies, the fundamental will undergo variations in amplitude of ±0.25dB while, by carrying out some calculations, variations in the Phase Delay in low frequency can reach an excursion of ±0.2ms; for HD3=-60dB (THD=0.1%) these values are reduced by 10 times and so on.
- 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 has been described translates into saying that the phase changes introduced by the dynamic systems in the 2nd and 3rd order distortions do not cause significant variations in the THD value. 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 the 2nd and 3rd order distortions.

*Fig. 11 – THD correction according to HD3/HD2 ratio.*

The figure 11 shows the extent of the corrections to be applied to the THD obtained from figure 2, considering the entire spectrum. Here the distortion values are calculated on the signal in the time domain (by Parseval's theorem, the result is equivalent to the classical one calculated in the frequency domain), again using the model in figure 6. We recall that the amount of correction does not depends on the absolute level of distortions. In the case of calculating the TD+N, the same considerations seen for static systems apply, and there is a dependence on the phases, but these are difficult to represent in a graph, given the number of variables involved (frequencies and phases of the different tones).

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

Let us now verify if there are impacts in the calculation of the IMD for the intermodulation measurements. With the two test tones used in the SMPTE and CCIF tests, the situation becomes more complicated, but not too much. The "luck" is due to the fact that the frequencies of the two tones are such as to generate distinct intermodulation products for 2nd and 3rd order distortion, as shown in the following figures.

*Fig. 12 – Simulation of the SMPTE test (two tones at 60Hz and 7KHz in a ratio of 4:1), with HD2 = HD3 = -40dB.*
*Fig. 13 – 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.

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 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 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 – Amplitude impacts on HD1 per HD3 phase and HD5/HD3 ratio.*
*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 (15dB or more), so the contribution of the higher harmonics cause negligible impacts to the graph of figure 11.