A square wave can be decomposed into the superposition of odd sine harmonics: \(f(t) = \frac{4}{\pi}\left(\sin\omega t + \frac{1}{3}\sin 3\omega t + \frac{1}{5}\sin 5\omega t + \cdots\right)\)
The charts below show the fundamental wave, and the process of progressively adding 3rd, 5th, 7th, 11th, 33rd, and 55th harmonics to approximate a square wave.
Fourier series of a periodic square wave (amplitude \(\pm1\), angular frequency \(\omega=2\pi f\)):
• Fundamental component: \(\frac{4}{\pi}\sin(\omega t)\)
• 3rd harmonic: \(\frac{4}{3\pi}\sin(3\omega t)\)
• 5th harmonic: \(\frac{4}{5\pi}\sin(5\omega t)\)
• 7th harmonic: \(\frac{4}{7\pi}\sin(7\omega t)\)
• 11th, 33rd, 55th harmonics follow the same pattern, with coefficient \( \frac{4}{n\pi} \).
As harmonics increase, the synthesized waveform approaches the ideal square wave, but Gibbs phenomenon (overshoot) appears at edges.
Ideal square wave, 50% duty cycle, instantaneous transition
\(f_1(t)=\frac{4}{\pi}\sin(\omega t)\), a single sine wave
Top begins to flatten, small ripples appear
Closer to square wave, rising edge steepens
Further approximation to square wave, Gibbs overshoot becomes evident
Rising edge steeper, top ripple denser, improved approximation
Steep edges, refined top oscillation, Gibbs overshoot stabilizes at 9%
High-order harmonics make waveform nearly perfect, only fine ripples and overshoot remain