Total Harmonic Distortion Calculator Formula

Understand the math behind the total harmonic distortion calculator. Each variable explained with a worked example.

Formulas Used

THD

thd_pct = rss_harmonics / v_fundamental * 100

THD

thd_db = 20 * log10(rss_harmonics / v_fundamental)

RSS of Harmonics

rss_total = rss_harmonics

Variables

VariableDescriptionDefault
v_fundamentalFundamental Amplitude(V)1
v_2nd2nd Harmonic(V)0.02
v_3rd3rd Harmonic(V)0.015
v_4th4th Harmonic(V)0.005
v_5th5th Harmonic(V)0.003
rss_harmonicsDerived value= sqrt(pow(v_2nd, 2) + pow(v_3rd, 2) + pow(v_4th, 2) + pow(v_5th, 2))calculated

How It Works

What is Total Harmonic Distortion?

THD measures the ratio of harmonic content to the fundamental, indicating how much a device distorts a pure signal.

Formula

THD = sqrt(V2^2 + V3^2 + V4^2 + V5^2 + ...) / V1 x 100%

Where V1 is the fundamental and V2, V3... are harmonic amplitudes.

Quality Benchmarks

  • < 0.01%: Audiophile/measurement grade
  • 0.01-0.1%: High fidelity
  • 0.1-1%: Consumer electronics
  • > 1%: Noticeable distortion
  • Worked Example

    Fundamental at 1.0 V with harmonics at 0.02, 0.015, 0.005, 0.003 V.

    v_fundamental = 1v_2nd = 0.02v_3rd = 0.015v_4th = 0.005v_5th = 0.003
    1. 01RSS = sqrt(0.02^2 + 0.015^2 + 0.005^2 + 0.003^2)
    2. 02= sqrt(0.0004 + 0.000225 + 0.000025 + 0.000009) = sqrt(0.000659)
    3. 03= 0.02567 V
    4. 04THD = 0.02567 / 1.0 x 100 = 2.567%
    5. 05THD dB = 20 x log10(0.02567) = -31.8 dB