Analyzing Harmonic Distortion

This example shows how to analyze the harmonic distortion of a weakly non-linear system in the presence of noise.

Introduction

In this example we will explore the output of a simplified model of an amplifier that has noise coupled to the input signal and exhibits non-linearity. We will explore how attenuation at the input can reduce harmonic distortion. We will also give an example of how to mathematically correct for the distortion at the output of the amplifier.

Viewing the Effects of Non-Linearity

A convenient way to view the effect of the non-linearity of the amplifier is to view the periodogram of its output when stimulated with a sinusoid. The amplitude of the sinusoid is set to the maximum allowable voltage of the amplifier. (2 Vpk)

In this example we will source a 2 kHz sinusoid for a duration of 50ms.

Note that instead of seeing just the 2 kHz sinusoid that we placed at the input, we see other sinusoids at 4 kHz, 6 kHz, 8 kHz, and 10 kHz. These sinusoids are multiples of the fundamental 2 kHz frequency and are due to the non-linearity of the amplifier.

We also see a relatively flat band of noise power.

Quantifying Non-Linear Distortion

Let's examine some common distortion metrics for comparison purposes

Our periodogram shows some very well defined harmonics of the fundamental signal. This suggests we measure the total harmonic distortion of the input signal which returns the ratio of power of all harmonic content to the fundamental signal.

thd(outputVmax, Fs)

ans = -60.3888

Notice that the third and largest harmonic is about 60 dB down from the fundamental. This is where most of the distortion is occurring.

We can also obtain an estimate of the total noise present in our input. To do this, we call SNR which returns the ratio of the power of the fundamental to the power of all non-harmonic content.

snr(outputVmax, Fs)

ans = 130.9300

Another useful metric to compute is SINAD. This computes the ratio of the power to all other harmonic and noise content in the signal.

sinad(outputVmax, Fs)

ans = 60.3888

The THD, SNR, and SINAD were -60 dB, 131 dB and 60 dB, respectively. Since the magnitude of THD is roughly equal to SINAD, we can attribute that most of the distortion is due to harmonic distortion.

If we inspect the periodogram, we can notice that the third harmonic dominates the distortion of the output.

Input Attenuation to Reduce Harmonic Distortion

Most analog circuitry performing amplification has an inherent trade-off between harmonic distortion and noise power. In our example, our amplifier has relatively low noise power compared to the harmonic distortion. This makes it suitable for detecting low power signals. If our input can be attenuated to enter this low-power region, we can recover some of the harmonic distortion.

Let's repeat the measurements by lowering the input voltage by a factor of two.

Let's redo our metrics again, this time measuring the effect of lowering the input voltage.

thdVhalf = thd(outputVhalf, Fs)

thdVhalf = -72.0676

snrVhalf = snr(outputVhalf, Fs)

snrVhalf = 124.8767

sinadVhalf = sinad(outputVhalf, Fs)

sinadVhalf = 72.0676

Notice that simply attenuating the input power level by 6 dB reduces the harmonic content. The SINAD and THD improved from ~60 dB to ~72 dB. This came at the expense of lowering the SNR from 131 dB to 125 dB.

SNR THD and SINAD as a Function of Input Attenuation

Can further attenuation improve our overall distortion performance? Let's plot THD, SNR and SINAD as a function of input attenuation, sweeping the input attenuator from 1 to 30 dB.

The graph shows the usable dynamic range corresponding to each metric. The magnitude of THD corresponds to the range that is free of harmonics. Similarly, SNR corresponds to the dynamic range of that is unaffected by noise; SINAD corresponds to the total dynamic range that is free of distortion.

As can be seen from the graph, SNR degrades as input power attenuation increases. This is because when you attenuate the signal, only the signal is attenuated, but the noise floor of the amplifier stays the same.

Also note that the magnitude of the total harmonic distortion improves steadily until it intersects the SNR curve, after which the measurement becomes unstable. This happens when the harmonics have "disappeared" beneath the noise of the amplifier.

A practical choice of amplifier attenuation for the amplifier would be 26 dB (yielding a SINAD of 103 dB). This would be a reasonable tradeoff between harmonic and noise distortion.

Here we have additionally plotted the level of total noise power that is spread across the spectrum. Note that at this attenuation setting, the second and third harmonic are still visible in the spectrum but also considerably less than the total noise power. If we were to have an application that uses a smaller bandwidth of the available spectrum we would benefit from further increasing the attenuation to reduce the harmonic content.

Post-processing to Remove Distortion

Occasionally we can correct for some of the non-linearity of the amplifier. If the output of the amplifier is digitized, we can recover more useful dynamic range by digitally post-processing the captured output and correcting for the non-linearity mathematically.

In our case, we stimulate the input with a linear ramp and fit a third-order polynomial that best fits the input.

Here, we've plotted all three metrics alongside for both the uncorrected and polynomial corrected amplifier.

As can be seen from the graph, THD has improved considerably, whereas SNR was not affected by polynomial correction. This is to be expected since the polynomial correction only affects the harmonic distortion and not the noise distortion.

Let's show the maximum SINAD possible when corrected by the polynomial

Note that all but the second harmonic disappeared entirely with polynomial correction under the ideal attenuation setting. As noted before the second harmonic appears just underneath the power level of the total noisefloor. This provides a reasonable tradeoff in applications which use the full bandwidth of the amplifier.

Summary

We have shown how polynomial correction can be applied to the output of an amplifier experiencing distortion and how to pick a reasonable attenuation value to reduce the effects of harmonic distortion.

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.

Was this topic helpful?

Select Your Country

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .