---
title: Non-sinusoidal waveforms
heading: Harmonics, RMS, distortion and true-RMS meters
eyebrow: C3 · Lesson 20 · Non-sinusoidal waveforms
xp: 40
---

::: hook
The mains voltage is close to a sine wave, but the current a laptop charger or LED lamp draws from it isn't: it arrives in short spikes near each peak. Square waves from switching circuits, triangle waves from integrators and the clipped output of an overdriven amplifier are all periodic but not sinusoidal. Each is a sum of sinusoids, a fundamental plus harmonics at whole multiples of its frequency (A10), and every AC tool in this course handles them one harmonic at a time. Doing so explains distortion figures, why a cheap meter misreads a square wave, and why a building's neutral wire can overheat.
:::

::: play
- A periodic waveform built from a fundamental at 50 Hz plus odd harmonics, in time (top) and as a spectrum (bottom).
- The starting weights, $\frac13$, $\frac15$ and $\frac17$ with alternating signs, are the square-wave recipe, and the trace already looks squarish. Shrink them toward zero and it relaxes back into a sine.
- Each spectral line is solved separately in a circuit, and the RMS readout adds them in squares.
:::
:::

```sim plot
view: spectrum
x: t = 0..40m s
y: v = -1.5..1.5 V
samples: 2048
freq: f = 0..1k Hz
slider: a3 = 0..0.5 step 0.01 = 0.33 V
slider: a5 = 0..0.3 step 0.01 = 0.2 V
slider: a7 = 0..0.2 step 0.01 = 0.14 V
plot: cos(2*pi*50*t) - a3*cos(2*pi*150*t) + a5*cos(2*pi*250*t) - a7*cos(2*pi*350*t) | label: v(t)
readout: RMS, V = sqrt(1 + a3^2 + a5^2 + a7^2)/sqrt(2) | digits: 3
readout: THD, % = 100*sqrt(a3^2 + a5^2 + a7^2) | digits: 3
```

::: predict
## A square wave switching between +1 V and −1 V is measured by an inexpensive meter that's accurate only for sine waves. It reads about:

- [ ] 0.71 V
- [ ] 1.00 V
- [x] 1.11 V
- [ ] 1.41 V

::: reveal
1.11 V, 11% high. An averaging meter measures the average of $|v|$ and multiplies by 1.11, the ratio of RMS to average for a sine. A square wave's average $|v|$ is 1 V, so it shows 1.11 V, though the true RMS is 1.00 V. A **true-RMS** meter computes the real RMS of any waveform.
:::
:::

::: nameit
## Harmonics

A periodic waveform of frequency $f$ is a DC term plus sinusoids at $f$, $2f$, $3f$, ... (A10). Waveforms with half-wave symmetry, like square and triangle waves, have only odd harmonics:

| Waveform (peak $A$) | Harmonic $n$ amplitude | RMS | Crest factor |
|---|---|---|---|
| sine | $A$ at $n = 1$ only | $A/\sqrt2$ | $\sqrt2$ |
| square | $\frac{4A}{n\pi}$, odd $n$ | $A$ | 1 |
| triangle | $\frac{8A}{n^2\pi^2}$, odd $n$ | $A/\sqrt3$ | $\sqrt3$ |

The **crest factor** is peak over RMS.

## RMS and distortion

Harmonics are at different frequencies, so they add in squares (lesson 8):

$$V_\text{rms} = \sqrt{V_0^2 + V_1^2 + V_2^2 + \ldots}$$

(each $V_n$ an RMS value). **Total harmonic distortion** compares everything but the fundamental with the fundamental:

$$\text{THD} = \frac{\sqrt{V_2^2 + V_3^2 + \ldots}}{V_1}$$

A square wave has 48% THD and a triangle 12%; a good audio amplifier, below 0.01%.

## Power with harmonics

Average power comes only from voltage and current harmonics of the *same* frequency: $P = \sum V_nI_n\cos\varphi_n$. When the supply voltage is a clean sine, harmonic currents deliver no power but still heat the wiring, so the power factor falls even with $\varphi_1 = 0$:

$$\text{pf} = \frac{\cos\varphi_1}{\sqrt{1 + \text{THD}_I^2}}$$

In a three-phase system, the third harmonic currents of the three phases are in step (120° × 3 = 360°), so instead of cancelling in the neutral they add: an office full of computers can push more current through the neutral than through any phase.
:::

::: example
## What is the RMS of the fundamental in a ±1 V square wave, and its THD?

::: solution
1. **Fundamental.** Its peak is $\frac{4}{\pi} = 1.273$ V, so its RMS is
   $$\begin{aligned} V_1 &= \frac{1.273}{\sqrt2} \\ &= 0.900\ \text{V} \end{aligned}$$
2. **Harmonics.** The total RMS is 1.000 V, so the harmonics together are
   $$\begin{aligned} V_h &= \sqrt{1 - 0.900^2} \\ &= 0.436\ \text{V} \end{aligned}$$
3. **THD.**
   $$\begin{aligned} \text{THD} &= \frac{0.436}{0.900} \\ &= 48\% \end{aligned}$$

**Answer:** the fundamental is 0.900 V RMS, and the THD is 48%.
:::
:::

::: example
## A rectifier load draws current with 80% THD, its fundamental in phase with the voltage. What is its power factor?

::: solution
1. **Power factor.** With the fundamental in phase with the voltage,
   $$\begin{aligned} \text{pf} &= \frac{1}{\sqrt{1 + 0.8^2}} \\ &= 0.78 \end{aligned}$$
2. **What it costs.** The load draws 28% more current than its power needs, all because of the harmonics.
3. **The fix.** Power supplies with **power factor correction** shape their input current into a sine to avoid this.

**Answer:** a power factor of 0.78.
:::
:::

::: example
## A triangle wave has peak A. What are its fundamental's amplitude and its THD?

::: solution
1. **Fundamental.** Its Fourier series has only odd harmonics, with amplitudes $\frac{8A}{\pi^2n^2}$, so the fundamental is
   $$\begin{aligned} A_1 &= \frac{8}{\pi^2}A \\ &= 0.811A \end{aligned}$$
2. **How fast the harmonics fall.** They fall as $\frac{1}{n^2}$, much faster than a square wave's $\frac1n$.
3. **THD.**
   $$\begin{aligned} \text{THD} &= \sqrt{\sum_{n = 3,5,\ldots}\frac{1}{n^4}} \\ &= \sqrt{\frac{\pi^4}{96} - 1} \\ &= 12.1\% \end{aligned}$$
   against 48.3% for a square wave.
4. **Why it matters.** Smoother waveforms have weaker harmonics, which is why slew-limited edges reduce interference.

**Answer:** the fundamental is 0.811A, and the THD is 12.1%.
:::
:::

::: check
given: A = 1 | 5 | 12; n = 1 | 3 | 5
answer: 4*A/(n*pi)
unit: V
tolerance: 0.5%

## A square wave of ±{A} V. What is the peak amplitude of its harmonic number {n}?

::: right
Right. $\frac{4A}{n\pi}$ = {answer}.
:::

::: misses
- [4*A/(n^2*pi^2)] That's the triangle-wave pattern ($1/n^2$, with $8A/\pi^2$).
- [any] Not yet. Square waves fall as $1/n$, starting at $4A/\pi$.
:::
:::

::: check
given: V0 = 0 | 2; V1 = 5 | 10; V3 = 1 | 3
answer: sqrt(V0^2 + V1^2 + V3^2)
unit: V
tolerance: 0.5%

## A voltage has {V0} V DC, {V1} V RMS at 50 Hz and {V3} V RMS at 150 Hz. What is its RMS value?

::: right
Right. $\sqrt{V_0^2 + V_1^2 + V_3^2}$ = {answer}.
:::

::: misses
- [V0 + V1 + V3] Different frequencies add in squares.
- [any] Not yet. Add the squares.
:::
:::

::: check
given: V1 = 10 | 100; V3 = 1 | 5; V5 = 0.5 | 2
answer: 100*sqrt(V3^2 + V5^2)/V1
tolerance: 0.5%

## A signal's fundamental is {V1} V RMS, with {V3} V RMS at the 3rd harmonic and {V5} V RMS at the 5th. What is its THD?

::: right
Right. $\frac{\sqrt{V_3^2 + V_5^2}}{V_1}$ = {answer}%.
:::

::: misses
- [100*(V3 + V5)/V1] Combine the harmonics in squares.
- [any] Not yet. RMS of the harmonics over the fundamental.
:::
:::

::: check
given: A = 1 | 2 | 10
answer: 1.1107*A
unit: V
tolerance: 0.5%

## A square wave of ±{A} V is read by an averaging meter calibrated for sine waves. What does it show?

::: right
Right. $1.11 \times$ the average of $|v|$, which is {A} V: {answer}.
:::

::: misses
- [A] That's the true RMS; an averaging meter multiplies the average by 1.11.
- [any] Not yet. Average of $|v|$ times $\frac{\pi}{2\sqrt2} = 1.11$.
:::
:::

::: check
given: thd = 30 | 80 | 150; c = 0.9 | 1
answer: c/sqrt(1 + (thd/100)^2)
tolerance: 0.5%

## A load's current has {thd}% THD, and its fundamental's displacement factor $\cos\varphi_1$ is {c}. What is its power factor, on a sinusoidal supply?

::: right
Right. $\frac{\cos\varphi_1}{\sqrt{1 + \text{THD}^2}}$ = {answer}.
:::

::: misses
- [c] Harmonic currents lower the power factor too.
- [any] Not yet. Combine the displacement and distortion factors.
:::
:::

::: check
given: I3 = 5 | 12 | 20
answer: 3*I3
unit: A
tolerance: 0.5%

## Each phase of a balanced three-phase load carries {I3} A RMS of third-harmonic current. What third-harmonic current flows in the neutral?

::: right
Right. Third harmonics are in step in all three phases, so they add: {answer}.
:::

::: misses
- [0] Fundamentals cancel in a balanced neutral, but third harmonics are in phase.
- [any] Not yet. 120° × 3 = 360°.
:::
:::

::: check
kind: parts
given: A = 1 | 5 | 10

## A triangle wave and a square wave each have peak {A} V.

::: part
answer: 8*A/pi^2
unit: V
tolerance: 0.5%

### What's the triangle's fundamental amplitude?

::: misses
- [4*A/pi] That's the square wave's fundamental.
- [any] $\frac{8A}{\pi^2}$.
:::
:::

::: part
answer: 4*A/pi
unit: V
tolerance: 0.5%

### And the square wave's?

::: misses
- [any] $\frac{4A}{\pi}$.
:::
:::
:::

::: check
kind: derivation
vars: A = 0.1..100

## A square wave of peak A.

::: step
answer: 4*A/pi

### What's its fundamental's amplitude?
:::

::: step
answer: A

### What's its RMS value?
:::

::: step
answer: sqrt(pi^2/8 - 1)

### What's its THD?
:::

::: right
Right. 48%, because its harmonics fall only as 1/n.
:::
:::

::: explain
## Why can the neutral wire of a building full of computers carry more current than any of the phase wires?

::: model
In a balanced three-phase system, the fundamental currents of the three phases are 120° apart and cancel in the neutral. Computer power supplies draw current in sharp pulses, rich in the third harmonic. Shifting a waveform by 120° shifts its third harmonic by 360°, so the three phases' third-harmonic currents are exactly in step and add in the neutral instead of cancelling. The neutral carries three times each phase's third-harmonic current, which can exceed the phase current itself, so such buildings use oversized neutrals.
:::
:::

::: practice

::: check
given: A = 0.5 | 1 | 2 | 3 | 5 | 10
answer: A/sqrt(3)
unit: V
tolerance: 0.5%

## What is the RMS of a triangle wave of peak {A} V?

::: misses
- [any] $A/\sqrt3$.
:::
:::

::: check
given: Vp = 5 | 10; Vrms = 3 | 5
answer: Vp/Vrms
tolerance: 0.5%

## A waveform peaks at {Vp} V with {Vrms} V RMS. What is its crest factor?

::: misses
- [any] Peak over RMS.
:::
:::

::: check
given: f = 50 | 60; n = 3 | 5 | 7
answer: n*f
unit: Hz
tolerance: 0.5%

## What frequency is harmonic {n} of {f} Hz?

::: misses
- [any] $nf$.
:::
:::
:::
