The Fourier series of a square wave
5 min read
Short answer
A square wave equal to on and on has the series : only odd sine harmonics, with amplitudes falling like . Near the jump, partial sums overshoot by about 9%, the Gibbs phenomenon.
The calculation
The wave is odd, so . Then . For even this is ; for odd it equals .
Convergence and Gibbs
At each jump, the series converges to the midpoint of the two sides ( here). Near the jump the partial sums overshoot by about of the jump size, and adding terms squeezes the overshoot toward the jump but never removes it.
Worked example
Use the series at to evaluate .
At the wave equals and alternates for . So , giving (the Leibniz series).
Try it yourself
What value does the Fourier series take at , where the square wave jumps from to ?
Show the answer
Every term vanishes at , so the series gives , the average of the two one-sided values.
Keep going with practice
Vidi's signals lessons build square waves in audio from exactly these odd harmonics.