Total harmonic distortion (source code)

= Total harmonic distortion
{title2=$\mathrm{THD}=\sqrt{\sum_{n\ge2}A_n^2}/A_1$}
{wiki}

= THD
{c}
{synonym}

<Total harmonic distortion> measures the root-sum-square <amplitude> of the selected higher <harmonic components> relative to the fundamental <amplitude>. For nonzero $A_1$ and one common <amplitude> convention,
$$
\mathrm{THD}_F=\frac{\sqrt{\sum_{n=2}^{M}A_n^2}}{A_1}.
$$
Peak <amplitudes> or <root mean square> <amplitudes> give the same ratio when used consistently for all <sinusoids>. The finite upper order $M$, measurement bandwidth, and treatment of noise must be specified. The primary Anritsu procedure distinguishes this fundamental-normalized definition from normalization by the full <harmonic component> sum.<Total Harmonic Distortion Measurements by Anritsu>[Printed p. 2, THD Definitions and Calculation Approach]{ref}

For an original example, let a waveform have fundamental peak <amplitude> $2\,\mathrm V$, second <harmonic component> $0.06\,\mathrm V$, and third <harmonic component> $0.08\,\mathrm V$, with no other components. Then
$$
\mathrm{THD}_F=\frac{\sqrt{0.06^2+0.08^2}}{2}=0.05=5\%.
$$
A logarithmic amplitude-ratio report is $20\log_{10}(0.05)\approx-26.02\,\mathrm{dB}$. The phases do not enter this RMS sum because distinct integer <harmonic components> are orthogonal over a full period.

If the denominator instead includes the fundamental and all included <harmonic components>, excluding DC, the resulting ratio is
$$
\mathrm{THD}_R=\frac{\mathrm{THD}_F}{\sqrt{1+\mathrm{THD}_F^2}},
$$
about $4.994\%$ in the example. The two conventions are close at low distortion but differ markedly when higher <harmonic components> are large; only the latter is bounded by one. A quoted percentage without its denominator convention is incomplete. Broadband noise is a different contribution and is not silently included in the displayed THD formula.

A motivating apparatus uses a clean sinusoidal source, the device under test, and calibrated receivers tuned to the fundamental and <harmonic component> <frequencies>. Anritsu's worked system calibrates the receiver over those <frequencies> before combining separate measurements.<Total Harmonic Distortion Measurements by Anritsu>[Printed p. 3, Figure 1; printed pp. 4–7, multichannel acquisition and combination]{ref} With an FFT-based instrument, <spectral leakage bias in harmonic distortion measurements> can misassign a strong fundamental to <harmonic component> bins; <aliasing> and insufficient receiver bandwidth can also hide or relocate components. Small <THD> therefore describes a stated test and analysis, not every possible waveform or operating level.