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 * 100THD
thd_db = 20 * log10(rss_harmonics / v_fundamental)RSS of Harmonics
rss_total = rss_harmonicsVariables
| Variable | Description | Default |
|---|---|---|
v_fundamental | Fundamental Amplitude(V) | 1 |
v_2nd | 2nd Harmonic(V) | 0.02 |
v_3rd | 3rd Harmonic(V) | 0.015 |
v_4th | 4th Harmonic(V) | 0.005 |
v_5th | 5th Harmonic(V) | 0.003 |
rss_harmonics | Derived 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
Worked Example
Fundamental at 1.0 V with harmonics at 0.02, 0.015, 0.005, 0.003 V.
- 01RSS = sqrt(0.02^2 + 0.015^2 + 0.005^2 + 0.003^2)
- 02= sqrt(0.0004 + 0.000225 + 0.000025 + 0.000009) = sqrt(0.000659)
- 03= 0.02567 V
- 04THD = 0.02567 / 1.0 x 100 = 2.567%
- 05THD dB = 20 x log10(0.02567) = -31.8 dB
Frequently Asked Questions
Is THD the same as THD+N?
No. THD measures only harmonics. THD+N includes noise and all non-harmonic distortion, making it a more comprehensive metric.
Do higher harmonics matter less?
In audio, odd harmonics (3rd, 5th) are perceived as harsher than even harmonics (2nd, 4th). But in the THD formula, all are weighted equally by the RSS.
How many harmonics should I include?
Include at least the first 5 harmonics. For precision, include up to the 10th or until harmonics fall below the noise floor.
Ready to run the numbers?
Open Total Harmonic Distortion Calculator