Math Methods · interactive
A square or sawtooth wave isn't one frequency — it's a whole stack of harmonics. Push that stack through a damped oscillator and each harmonic gets its own gain and phase shift from the transfer function. Most pass through quietly. But if a harmonic lands near the natural frequency, that one term can swallow the whole response — even if it was a tiny piece of the input.
Forcing f(t) (dashed) vs. steady-state response x(t) (solid)
Harmonic spectrum · input amplitude bₙ vs. output amplitude bₙ|H(rₙ)|
—
ωₙ is fixed as the reference; harmonic n drives at frequency nω₀, so rₙ = nω₀/ωₙ.
The forcing f(t) is periodic but not sinusoidal, so you can't read its response straight off a Bode plot — until you break it into harmonics. Each term bₙ sin(nω₀t) is a plain sinusoid at frequency nω₀, and because the ODE is linear, each one sails through the system independently, picking up gain |H(rₙ)| and phase shift ∠H(rₙ) from the exact same transfer function as the frequency response lab. Add the harmonic responses back up and you have the full steady-state x(t) — this is Bjorn Poonen's §27.2 method (see the further reading below), and it's also literally how a radio tuner pulls one station out of the full broadcast spectrum.
Watch the spectrum chart as you sweep ω₀: most harmonics get amplified by something close to 1, but whichever one lands nearest rₙ=1 gets the resonant boost ≈1/(2ζ). With light damping (small ζ) that boost is enormous — so a harmonic that started as a minor ripple in the input can become the dominant feature of the output. This is exactly how a small periodic nudge (a poorly balanced fan blade, a marching crowd, an engine's firing pulses) can shake a structure far harder than the size of the nudge would suggest, if one of its harmonics happens to hit a natural frequency.
A square wave's coefficients fall off like 1/n (only odd harmonics, thanks to its odd symmetry around the midline) — its higher harmonics stay loud for a long time, which is why its corners are so stubborn in the Fourier builder. A triangle wave's coefficients fall like 1/n² — almost all the energy is in the fundamental, so resonance only matters if ω₀ itself is near ωₙ. Try both at the same ζ and ω₀ and compare how "spiky" the output spectrum looks.
EngineeringCandy · Fourier decomposition + transfer function, superposed live · sweep it, tune it, learn