Total Harmonic Distortion⚠ unverified
Electrical / Power · Compute the total harmonic distortion (THD)
Parameters
| Input | Symbol | Unit | Default | Description |
|---|---|---|---|---|
| V_rms | Vrms | V | 1.0 | Total RMS value of the signal |
| V_fundamental | Vfundamental | V | 1.0 | RMS value of the fundamental component |
| Output | Symbol | Unit | Description |
|---|---|---|---|
| result | THD | — | Total harmonic distortion as a dimensionless ratio. Returns 0.0 if ``V_fundamental`` is not positive |
The science & history
Understanding the Parameters
- $V_{rms}$ — the RMS of the entire waveform, including every harmonic.
- $V_1$ — the RMS of just the fundamental (the intended sine at the base frequency).
- THD — the harmonic "excess" as a fraction of the fundamental; audio aims for <0.1 %, power systems typically limit voltage THD to a few percent.
Derivation (Approaching a Proof)
By Fourier analysis a periodic signal is the sum of a fundamental plus harmonics, and by Parseval's theorem their mean‑squares add (the components are orthogonal):
$$V_{rms}^2 = V_1^2 + V_2^2 + V_3^2 + \cdots$$
The combined RMS of all the harmonics (everything but the fundamental) is therefore
$$V_{harm} = \sqrt{V_2^2 + V_3^2 + \cdots} = \sqrt{V_{rms}^2 - V_1^2}.$$
THD is defined as that harmonic RMS divided by the fundamental:
$$\mathrm{THD} = \frac{\sqrt{V_{rms}^2 - V_1^2}}{V_1} = \sqrt{\left(\frac{V_{rms}}{V_1}\right)^2 - 1}.$$
The same orthogonal decomposition underlies the rectifier Rectifier Ripple Factor (DC vs AC) and the distortion component of Power Factor — all are "how much of the RMS is not the wanted component."
History
Harmonic distortion analysis grew with audio amplifiers (where THD quantifies fidelity) and, later, with power‑quality engineering as nonlinear electronic loads (rectifiers, drives, LED supplies) proliferated. Standards such as IEEE 519 now cap THD to protect the grid from harmonic pollution.
Related Concepts: Rectifier Ripple Factor, Power Factor, Apparent Power
Notes: Registry calculator total-harmonic-distortion (unverified). Uses the "THD relative to
fundamental" convention; a variant normalises to the total RMS instead.