A831 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

A8 · Lesson 31 · Periodic inputs and Fourier series

A square wave is a sum of sines, and a linear circuit answers each one separately

Lesson 30's phasors answer a single sine. Real drives are rarely single sines: a microcontroller's PWM output is a square wave, a rectifier delivers half-sine humps, a switching converter's node is a trapezoid. Each of these repeats, and every repeating waveform is a sum of sines at multiples of its frequency, its Fourier series. Because the circuit's equation is linear, the response to the sum is the sum of the responses, each harmonic multiplied by the circuit's gain at its own frequency. That's how a low-pass smooths a PWM signal, and how a tuned circuit can pull a pure sine out of a square wave.

  • A ±1 V, 1 kHz square wave (time in milliseconds) drives an RC low-pass with its corner at fc kHz. The curve is the steady-state output built from the odd harmonics up to N (at most 15), each through the filter's gain at its frequency.
  • With a few harmonics the output already looks right; the corner frequency decides how much of the square's sharp edges survive.

Predict

A ±1 V, 1 kHz square wave drives a series RLC tuned to 3 kHz with a high Q, and you look at the voltage across the resistor. What comes out?

Name it

Fourier series

A waveform that repeats every T seconds, with ω0=2π/T, can be written

u(t)=a0+∑n=1∞cncos⁡(nω0t+φn)

Three to know:

WaveformHarmonics
Square wave, ±Aodd n only, 4Aπnsin⁡(nω0t)
Triangle wave, ±Aodd n only, amplitude 8Aπ2n2
Sawtooth, ±Aevery n, amplitude 2Aπn

A jump in the waveform makes the harmonics fall as 1/n; a kink with no jump makes them fall as 1/n2. Smoother waveforms have weaker high harmonics.

The response, harmonic by harmonic

For a linear circuit with frequency response H(jω), each harmonic comes out multiplied by |H(jnω0)| and shifted by ∠H(jnω0):

y(t)=H(0)a0+∑n|H(jnω0)|cncos⁡(nω0t+φn+∠H(jnω0))

That's the steady state, after the starting transient (lesson 14) has died away.

Power and RMS

Harmonics at different frequencies don't interfere on average, so their powers add (Parseval):

Vrms2=a02+∑ncn22

The total harmonic distortion compares everything but the fundamental with the fundamental: THD=∑n≥2cn2/c1.

Worked example

A ±1 V, 1 kHz square wave drives an RC low-pass whose corner is also 1 kHz. Find the output's first three harmonics.

Show the solution
  1. Gain at each harmonic. The filter's gain at harmonic n is 1/1+n2, since nf0/fc=n.
  2. Scale each input harmonic. The square wave's harmonic n has amplitude 4/(πn):
nIn: 4/(πn)GainOut
11.273 V0.7070.900 V
30.424 V0.3160.134 V
50.255 V0.1960.050 V
  1. How the harmonics fall. The output harmonics now fall as 1/n2, like a triangle's: the filter has rounded the square's corners into exponential ramps.
  2. The full waveform. Adding up enough harmonics reproduces the exact steady state, a pair of exponential segments with peak-to-peak 2tanh⁡(T/4τ) = 1.834 V.

Answer the first three output harmonics are 0.900 V at 1 kHz, 0.134 V at 3 kHz and 0.050 V at 5 kHz.

Worked example

The same square wave drives a series RLC bandpass at 3 kHz with Q = 10 (output across the resistor). Find the output's harmonics and its THD.

Show the solution
  1. The bandpass gain. A series RLC's gain at frequency f is 11+Q2(f/fr−fr/f)2
  2. Apply it to each harmonic. With fr = 3 kHz and Q = 10:
nGainOut
10.03750.048 V
310.424 V
50.0930.024 V
70.0520.010 V
  1. The result. The output is a 0.424 V, 3 kHz sine with a THD of 12.9%, almost all of it from the leftover fundamental.
  2. Why the fundamental leaks through. A higher Q would clean it further; with Q = 10 the fundamental is only rejected by a factor of 27, because 1 kHz is just a factor of 3 below resonance.

Answer the output is mostly a 0.424 V, 3 kHz sine, with 0.048 V at 1 kHz, 0.024 V at 5 kHz and 0.010 V at 7 kHz, for a THD of 12.9%.

Worked example

Check the low-pass result without harmonics: what is the exact steady-state peak-to-peak output of the RC low-pass (τ = 0.159 ms) driven by the ±1 V, 1 kHz square wave?

Show the solution
  1. The steady-state cycle. In the steady state the capacitor charges toward +1 V for half a period, then toward −1 V for the other half, ending each half where it started the previous one with the sign flipped.
  2. Write the first half. With swing ±vp, vp=1−(1+vp)e−T/2τ
  3. Solve for vp. vp=1−e−T/2τ1+e−T/2τ=tanh⁡T4τ
  4. Put in the numbers. With T/4τ=1.571, tanh⁡1.571=0.917 and the peak-to-peak is 1.834 V.
  5. Compare with the Fourier sum. Summing the Fourier series with a thousand harmonics gives the same 1.834 V, so the two methods agree. The Fourier view explains which frequencies remain; the time-domain view gives the waveform directly.

Answer the output swings 1.834 V peak to peak, between −0.917 V and +0.917 V.

Check

What is the amplitude of harmonic 3 of a square wave that switches between +2.5 and −2.5 V?

Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.

Check

A ±1 V square wave at frequency f0 drives an RC low-pass whose corner is f0/2. What is the amplitude of harmonic 3 at the output?

Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.

Check

A ±1 V square wave at f0 drives a series RLC bandpass tuned to harmonic 3 (fr=3f0) with Q = 10.

(a)

What is the bandpass's gain at the fundamental?

(b)

What is the output's amplitude at harmonic 3?

Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.

Check

A ±A V, 1 kHz square wave drives an RC low-pass with corner fc = 1 kHz. Build its steady-state output from the odd harmonics n=1,3,…,1999, each through the filter's complex gain 1/(1+jnf0/fc), at 4000 times across one period. Set pp_fourier to the peak-to-peak of the sum and pp_exact to 2Atanh⁡(T/4τ) with τ=1/(2πfc).

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

A ±1 V square wave drives a series RLC bandpass tuned to harmonic m = 3 with Q = 10. Set amps to a list of the output amplitudes of harmonics 1, 3, 5, …, 99, and thd to the output's total harmonic distortion relative to harmonic m.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Which waveform's harmonics fall off fastest with n?

Check

Find the coefficient bn of sin⁡(nω0t) for a square wave that is +A for the first half period and −A for the second, with ω0=w.

Step 1

bn=2T∫0Tu(t)sin⁡(nω0t)dt. By the waveform's symmetry this is twice the integral over the first half. What is it?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why can a circuit's response to a square wave be found one harmonic at a time?

Practice

Keep practicing

7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.