Search this site
Contact Us

Total Harmonic Distortion: Theory and Practice

*Please note THD is only available in software version 7.8.4 or higher

This application note discusses Total Harmonic Distortion (THD), which shares characteristics with Electrochemical Impedance Spectroscopy (EIS). Both share the experimental basics but differ in the analysis of measurement data.

In addition, we review the differences between linear and non‑linear signal responses. In contrast to EIS, THD is also able to analyze non‑linear signal responses by using Fast‑Fourier‑Transform (FFT). We show how non‑linearity can affect measured data and how THD can be used to check for non‑linear behavior.

The fact that most electrochemical systems such as fuel cells are non‑linear makes THD a useful tool. It helps exposing any non‑linear behavior indicating unwanted side reactions which can be detrimental to the system and measured data.


Similarities between EIS and THD

Total Harmonic Distortion is an extended version of Electrochemical Impedance Spectroscopy. Both techniques are based on a sinusoidal AC signal (controlled current or controlled voltage) which is applied to an electrochemical system. The excitation signal Et can be expressed in terms of frequency as well as time t:

Expressed terms of frequence & time

E0 is the amplitude of the applied sine wave and ω is the radial frequency, which can be also expressed using frequency f as shown in Equation 2:

Aplitude of the applied sine wave & radial frequency

The measured signal It gives a sinusoidal response with the same frequency, but amplitude I0 may be different, and phase angle f may be shifted (see also Figure 1).

Sinusoidal response with the same frequency

Figure 1 EIS time domain

Figure 1. Sinusoidal excitation signal (green) and linear response signal (blue).

However, note that Equation 3 is only valid if the observed system gives a linear signal response.

For more information on the theory of electrochemical impedance spectroscopy, see Gamry’s application note:
Basics of Electrochemical Impedance Spectroscopy.

Finally, the impedance Z of an electrochemical system can be calculated for each frequency in a method analogous to Ohm’s law:

impedance Z of an electrochemical system

Linear versus non‑linear

As mentioned above, Equations 3 and 4 are only valid if the observed system provides a linear signal response. Any deviation from linearity can lead to error‑prone or even wrong measurement data.

In real applications, electrochemical systems behave strictly non‑linear. However, a system can be assumed to be linear by applying a small-enough AC amplitude. The observed system is then called pseudo‑linear. This method allows you to calculate the impedance even though the system is strongly non‑linear as a whole (see also Figure 2).

Diagram of a polarization curve

Figure 2. Diagram of a polarization curve illustrating the observed pseudo‑linear range during EIS and THD experiments.
The observed region shows also the origin of Lissajous diagrams.

Linearity can’t be guaranteed if the AC amplitude is set improperly. An applied AC amplitude of 5 – 10 mV may be familiar to many who perform EIS experiments. However, these values may not be practical for any given system under study, and they are often used merely because they are set by default in the software.

For example, high‑power energy systems may be best measured using current‑controlled AC amplitudes of several amperes, whereas a corrosive system would likely be best studied using potential‑controlled AC signals of 10 mV or less. If set incorrectly, measurements can lead to either noise‑prone EIS data (too small AC amplitude) or non‑linear measurement results (too large AC amplitude). As a result, impedance calculation can be imprecise, inaccurate, or even invalid when Equations 3 and 4 are not valid.

measured impedance data which are too distortedAny measured impedance data which are too distorted, i.e., non linear, can lead to falsified results.

However, EIS does not have any quantitative methods to check if a measured signal response is linear or not. Qualitative monitoring of Lissajous diagrams (see also Figure 2) — displaying the measured signal versus the applied signal — are generally the only way to evaluate the system’s state. Gamry Instruments’ software displays these curves during EIS and THD experiments for each frequency, but they provide no tangible parameter with which to work later.

In contrast, THD analyzes any non‑linearities in the measured system and provides a parameter which can be used for later evaluations.

THD gives information about non‑linear behavior

As mentioned above, Total Harmonic Distortion is a useful technique to analyze any non‑linear behavior of a system. 

You can do this with a Fast Fourier Transform (FFT). The measured signal is transformed from the time domain (see Figure 1) into the frequency domain. The transformed data can be displayed in a so‑called FFT‑spectrum in which the response signal’s magnitude is plotted versus the frequency.

Figure 3 shows the FFT‑spectrum of an ideal sine wave signal. As the graph shows, only a single peak appears at the fundamental frequency f of the applied signal.

FFT spectrum of an ideal sinusoidal signal.

Figure 3. FFT‑spectrum of an ideal sinusoidal signal. The original signal in the time domain is shown top right.

Figure 4 shows the FFT‑spectrum of a distorted, non‑linear sinusoidal signal. The largest peak can be observed at the fundamental frequency f1 of the signal. Additional peaks appear at integral multiples of the fundamental frequency (f2 = 2·f1, f3 = 3·f1, f4 = 4·f1, etc.). The peaks are called harmonics and represent the non‑linear behavior of a signal. The magnitude of the harmonics increases the more non‑linear the signal is.

FFT spectrum of a non ideal, distorted sinusoidal signal

Figure 4. FFT‑spectrum of a non‑ideal, distorted sinusoidal signal. The original signal in the time domain is shown top right.

The obtained FFT data can be used to calculate the so‑called THD factor. We will call it either THDE if the measured signal is a potential or THDI for a current response. The THD factor describes the ratio between the root mean square (RMS) of the harmonics’ magnitudes (Yn) and the RMS magnitude of the fundamental frequency (Y1). The general equation for the THD factor is as follows:

 total harmonic distortion (THD or THDi) is a measurement of the harmonic distor EQ5

Typically, calculations are performed up to the 10th order (n = 10). As the equation shows, the THD factor increases the larger the harmonics are in relation to the fundamental magnitude, i.e., the more non‑linear a signal response is. For example, a THD factor of 40% means that the RMS magnitudes of the harmonics are 40% of the fundamental’s RMS magnitude. A perfectly linear signal as shown in Figure 3 gives a factor of 0%.

The THD factor is calculated for each frequency analogous to the impedance Z. It can be then plotted versus the frequency of the applied sinusoidal signal as shown in Figure 7.

Note that THD calculations are not restricted to sinusoidal signals but can be applied to any continuous signals such as square‑wave or triangle signals. Also keep in mind that there are different definitions for the THD factor and how it is calculated. Some describe the demonitator of Equation 5 with data of both fundamental frequency as well as harmonics. Other definitions do also add noise to the calculations.


The results of measuring a system by using different AC amplitudes to produce linear and non‑linear data sets are shown in this section.

For this, a CR2032 lithium‑ion battery with a nominal capacity of 40 mAh was used. Before each measurement, the battery was charged to 3.6 V and then potentiostatically held at this potential for 4 h. Afterwards, galvanostatic THD experiments were performed between 10 kHz and 1 mHz. The DC current was set to 0 A while the AC amplitude was varied. The applied current amplitude was set to 4 mA (0.1 C‑rate) and 10 mA (0.25 C‑rate) in order to achieve a more linear response. Larger amplitudes of 20 mA (0.5 C‑rate) and 40 mA (1 C‑rate) were used to create a non‑linear response.

Potentiostatic EIS

THD is available as an option for potentiostatic and galvanostatic scripts.

THD option on Galvanostatic EIS

Figure 5 shows the Bode diagrams of the corresponding THD experiments. Linear impedance data are shown in orange colors and non‑linear data sets are marked blue.

Bode diagrams of a coin cell using different AC amplitudesFigure 5. Bode diagrams of a coin cell using different AC amplitudes. (yellow dot) 4 mA, (red dot2) 10 mA, (lt blue dot) 20 mA, (dk blue dot) 40 mA.
Orange hues represent linear while blue hues represent non-linear measurement data.

The curves with the lowest amplitudes overlap quite well over the whole frequency range. Even the curve with a 20 mA amplitude is consistent down to about 40 mHz. However, differences become more obvious at lower frequencies where the impedance increases to a greater extent the larger the applied AC amplitudes get. At very large amplitudes, even the high‑frequency region is affected, for the measured impedance shows consistently higher values.

Also note that the experiment with a 40 mA amplitude (1 C‑rate) had to be stopped prematurely. The reason is that the large current discharged the battery at low frequencies so much that a critical potential was reached. Continuing the experiment could have damaged the cell irreversibly.

Figure 6 shows the corresponding Nyquist plots. For the sake of simplicity, only two graphs using 4 mA (orange) and 40 mA (blue) AC amplitudes are shown.

Nyquist diagrams of a coin cell using different AC amplitudes

Figure 6. Nyquist diagrams of a coin cell using different AC amplitudes. (yellow dot) 4 mA, (dk blue dot) 40 mA.
Orange hues represent linear while blue hues represent non-linear measurement data.

In accordance with the results of the Bode diagrams, the Nyquist plots do show major differences in the low‑frequency region. The semi‑circle of the non‑linear measurement data extends farther, as does the diffusion‑related part at very low frequencies.

In addition to Bode and Nyquist diagrams, THD experiments also provide info about the measured signal’s linear behavior. Figure 7 shows the corresponding THD factors which are automatically calculated for each frequency.

Analogous to the Bode diagrams shown in Figure 5, the high‑frequency region is similar (more linear) across all excitation amplitudes. In contrast, the low‑frequency region shows major differences. THDE increases when using amplitudes of 20 mA and increases further with the 40 mA amplitude, indicating that the measured signal response becomes strongly non‑linear in the lower frequency region.

THD curves of a coin cell

Figure 7. THDE‑curves of a coin cell using different AC amplitudes. (yellow dot) 4 mA, (red dot2) 10 mA, (lt blue dot) 20 mA, (dk blue dot) 40 mA.
Orange hues represent linear while blue hues represent non-linear measurement data.

A linear signal response over a wider frequency range can be only achieved by applying lower signal amplitudes. As shown in Figure 7, the curves with smaller amplitudes do exhibit small THDE‑values over a wide frequency range, allowing more accurate and reproducible impedance results.

dont forget yellowThere is no setpoint value for the THD factor that defines if a measured signal is linear or non linear. The THD factor is best used as an indicator of the system’s behavior.


High‑quality impedance data can be only achieved by applying AC amplitudes that are small enough to produce a linear response but large enough to provide good signal‑to‑noise ratio over the observed frequency range.

Our experiments showed how measurement results can vary by using different AC amplitudes. In particular, amplitudes that are too large for the observed system and produce non‑linear response exhibit differences which can be seen in Bode and Nyquist plots. Both curves are shifted compared to valid results. Deviations are generally more significant in the low‑frequency region where larger AC amplitudes disturb the electrochemical equilibrium more.

Total Harmonic Distortion is hereby a helpful measurement technique which provides quantitative information about the measured signal response. This additional information in the form of the so‑called THD factor can help to evaluate if the measured signal is non‑linear — eventually causing imprecise, inaccurate, or even invalid results — or if the signal response is linear, resulting in valid impedance data.

Total Harmonic Distortion: Theory and Practice.  Rev. 1.1 4/15/2021© Copyright 2021Gamry Instruments, Inc.