Sub topic 14
RMS of Square, Triangle, and Other Waveforms
This chapter assumes you know the RMS definition and the sine-wave result Vrms = Vm/√2 from earlier chapters. It also assumes you can integrate simple polynomials and trigonometric functions over one period. Here you will apply the definition to waveforms that are not sine waves and see why a meter's design decides whether its reading can be trusted.
The definition does not depend on the shape
RMS stands for the root of the mean of the square. For any periodic signal v(t) with period T:
Vrms = √( (1/T) ∫ v(t)² dt ), integrated over one period.
The √2 in Vm/√2 comes from the mean of sin², which is 1/2. A different shape has a different mean square and so a different factor. Three steps always work:
- Square the waveform point by point.
- Average the squared waveform over one full period.
- Take the square root.
Squaring happens before averaging. The average of a symmetric waveform is zero, but its mean square is always positive.
Symmetric square wave
A square wave that switches between +Vm and −Vm spends all its time at magnitude Vm. Its square is the constant Vm², so the mean square is Vm² and:
Vrms = Vm
A ±10 V square wave across a resistor delivers the same heating as a 10 V DC source. The sine wave reaches its peak only briefly, so it needs a higher peak (14.14 V) to deliver the same power.
Triangle and sawtooth waves
Consider a triangle wave that ramps linearly from 0 to Vm in the first quarter period, so v(t) = Vm·(4t/T) for 0 ≤ t ≤ T/4. The waveform is symmetric, so every quarter period has the same mean square. It is enough to average over that one quarter:
mean square = (1/(T/4)) ∫₀^{T/4} Vm² (4t/T)² dt
Substitute x = 4t/T, which runs from 0 to 1. The mean square becomes Vm² ∫₀¹ x² dx = Vm²/3. Therefore:
Vrms = Vm/√3 ≈ 0.577 Vm
A symmetric sawtooth ramping from −Vm to +Vm is one straight line per period. Its squared shape matches the triangle's, so it has the same RMS value, Vm/√3.
Rectified sine waves
Rectification removes or flips the negative half of a sine wave. The RMS values follow from the sine result.
- Full-wave rectified sine. Squaring removes the sign, so v² is the same as for the original sine. Vrms = Vm/√2, but the average is now 2Vm/π ≈ 0.637 Vm instead of zero.
- Half-wave rectified sine. Half of each period is zero, so the mean square is half that of a full sine: (Vm²/2)/2 = Vm²/4. Vrms = Vm/2. The average is Vm/π ≈ 0.318 Vm.
Pulse trains and duty cycle
A pulse train sits at Vm for a fraction D of each period (the duty cycle) and at 0 V for the rest. The squared signal is Vm² for a fraction D of the time, so the mean square is D·Vm² and:
Vrms = Vm√D
The average is D·Vm. A 25% duty cycle gives Vrms = 0.5 Vm, while the average is only 0.25 Vm. This is why PWM-driven loads heat according to the RMS value, not the average.
Summary table
Crest factor is the peak value divided by the RMS value. It describes how spiky a waveform is.
| Waveform (peak Vm) | Average of \ | v\ | Column | RMS | Crest factor |
|---|---|---|---|---|---|
| Symmetric square | Vm | Vm | 1 | ||
| Sine | 2Vm/π ≈ 0.637 Vm | Vm/√2 ≈ 0.707 Vm | 1.414 | ||
| Triangle or sawtooth | Vm/2 | Vm/√3 ≈ 0.577 Vm | 1.732 | ||
| Full-wave rectified sine | 2Vm/π ≈ 0.637 Vm | Vm/√2 ≈ 0.707 Vm | 1.414 | ||
| Half-wave rectified sine | Vm/π ≈ 0.318 Vm | Vm/2 | 2 | ||
| Pulse, duty cycle D (0 to Vm) | D·Vm | Vm√D | 1/√D |
The average column uses the average of the absolute value, because the ordinary average of a symmetric waveform is zero. That absolute-value average matters in the meter section below.
Checking the results numerically
The script below builds one period of each waveform and computes the RMS by following the definition directly. Sampling exactly one period with endpoint=False avoids counting the first point twice.
import numpy as np
# One period, normalized to T = 1, peak value 1
t = np.linspace(0, 1, 200000, endpoint=False)
sine = np.sin(2 * np.pi * t)
waveforms = {
"square": (np.where(t < 0.5, 1.0, -1.0), 1.0),
"sine": (sine, 1 / np.sqrt(2)),
"triangle": ((2 / np.pi) * np.arcsin(sine), 1 / np.sqrt(3)),
"sawtooth": (2 * t - 1, 1 / np.sqrt(3)),
"half-wave": (np.maximum(sine, 0.0), 0.5),
"pulse D=0.25": (np.where(t < 0.25, 1.0, 0.0), np.sqrt(0.25)),
}
for name, (v, expected) in waveforms.items():
rms = np.sqrt(np.mean(v ** 2))
print(f"{name:13s} RMS = {rms:.4f} expected = {expected:.4f}")Each computed value should agree with its expected value to about three decimal places.
Waveforms with a DC offset
Many real signals are an AC part riding on a DC level. If v(t) = Vdc + vac(t) and vac has zero average, the cross term in v² averages to zero. The result is:
Vrms² = Vdc² + Vac,rms²
The two parts add as powers, not as voltages. A 3 V DC level with an AC part of 4 V RMS gives √(9 + 16) = 5 V RMS, not 7 V.
The same idea applies to a sum of sinusoids at different frequencies. The cross terms between different frequencies also average to zero over a long enough time, so the mean squares add. A symmetric square wave of amplitude Vm has a fundamental sine component of amplitude 4Vm/π. Its power fraction is (4/π)²/2 = 8/π² ≈ 0.81. Only 81% of the square wave's power sits in its fundamental. The rest is in its odd harmonics.
Measuring non-sinusoidal waveforms
Meters compute RMS in one of two ways, and the difference matters for the shapes above.
- Average-responding meter. It rectifies the signal, averages it, and multiplies by the sine form factor 1.1107 (that is, (Vm/√2)/(2Vm/π)). The scaling is correct only for sine waves.
- True-RMS meter. It squares, averages, and takes the root, either electronically or digitally. It is correct for any shape within its bandwidth and crest-factor limits.
For a ±10 V square wave, an average-responding meter sees an average of 10 V and shows 1.1107 × 10 ≈ 11.1 V, about 11% high. For a triangle wave of the same peak, the average is 5 V, so it shows about 5.55 V, whereas the true RMS is 5.77 V. That reading is about 3.8% low.
An oscilloscope with a measurement function computes RMS from its sampled points over whole periods on screen. If the displayed window covers a fractional number of periods, the result is biased, so set the timebase to show whole cycles.
Power in a resistor
The heating property carries over to every shape. The average power in a resistor R is P = Vrms²/R for any periodic waveform. A 10 V peak square wave across 5 Ω gives P = 100/5 = 20 W. A 10 V peak triangle wave across the same resistor gives P = (100/3)/5 ≈ 6.67 W. The square wave delivers three times the power at the same peak.
Common errors
- Averaging first and squaring afterwards. This gives zero for any symmetric waveform.
- Using Vm/√2 for every waveform. That factor belongs to sine waves.
- Adding RMS values of components directly. Add their squares instead.
- Trusting an average-responding meter on non-sinusoidal signals.
Exercise
A triangle wave swings between −6 V and +6 V and has a 2 V DC offset added to it. What is its RMS value?
Show answer
The AC part is a triangle with peak 6 V, so its RMS is 6/√3 = 3.464 V and its mean square is 36/3 = 12 V². The DC part contributes 2² = 4 V². The total mean square is 12 + 4 = 16 V², so Vrms = √16 = 4 V.
Exercise
An average-responding meter, calibrated for sine waves, measures a symmetric ±10 V square wave. What does it display, and what is the percentage error compared with the true RMS?
Show answer
The average of |v| is 10 V, and the meter multiplies by 1.1107, so it displays about 11.1 V. The true RMS is 10 V. The error is (11.107 − 10)/10, about +11% (reads high).