How do you calculate THD?
Harmonic distortion may be measured by applying a spectrally clean sine wave voltage signal to the input of the amplifier under test (may require a band pass or low pass filter if the excitation RF source has high harmonic output content).
How do I get THD in Matlab?
r = thd( x ) returns the total harmonic distortion (THD) in dBc of the real-valued sinusoidal signal x . The total harmonic distortion is determined from the fundamental frequency and the first five harmonics using a modified periodogram of the same length as the input signal.
Why do we calculate THD?
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.