TExcelTAD
Home › Differential Equations › Forced Oscillations and Resonance

Forced Oscillations and Resonance

Push a swing at the right moments and it goes higher and higher. A periodic force acting on a spring system can build up enormous amplitudes when its frequency matches the system's natural frequency. This lesson solves

mx′′+cx′+kx=F0cos⁡ωtm x'' + c x' + k x = F_0\cos\omega t

and explains beats, resonance and the frequency response curve.

Undamped forcing: beats

With c=0c = 0 and ω≠ω0=k/m\omega \ne \omega_0 = \sqrt{k/m}, undetermined coefficients gives

xp=F0m(ω02−ω2)cos⁡ωt.x_p = \frac{F_0}{m(\omega_0^2 - \omega^2)}\cos\omega t.

Starting from rest, x(0)=x′(0)=0x(0) = x'(0) = 0, the solution is

x=F0m(ω02−ω2)(cos⁡ωt−cos⁡ω0t)=2F0m(ω02−ω2)sin⁡ ⁣(ω0−ω2t)sin⁡ ⁣(ω0+ω2t).x = \frac{F_0}{m(\omega_0^2 - \omega^2)}\left(\cos\omega t - \cos\omega_0 t\right) = \frac{2F_0}{m(\omega_0^2 - \omega^2)}\sin\!\left(\frac{\omega_0 - \omega}{2}t\right)\sin\!\left(\frac{\omega_0 + \omega}{2}t\right).

When ω\omega is close to ω0\omega_0, a fast oscillation is modulated by a slow envelope: beats, which musicians hear when tuning two strings that are almost in tune.

Pure resonance

If ω=ω0\omega = \omega_0 the guess collides with the homogeneous solution, and the modification rule gives

xp=F02mω0 tsin⁡ω0t.x_p = \frac{F_0}{2m\omega_0}\,t\sin\omega_0 t.

The amplitude grows linearly without bound. Real systems either have damping or break.

python · try it yourself
import numpy as np
from scipy.integrate import solve_ivp

m, k, F0 = 1.0, 4.0, 1.0                      # omega_0 = 2
for w in (1.0, 1.9, 2.0):
    sol = solve_ivp(lambda t, Y: [Y[1], (F0 * np.cos(w * t) - k * Y[0]) / m], (0, 60), [0.0, 0.0],
                    max_step=0.01, rtol=1e-9, atol=1e-12)
    print(f"omega = {w}: max |x| on [0, 60] = {np.max(np.abs(sol.y[0])):.3f}")
print("resonance envelope at t = 60:", 60 * F0 / (2 * m * 2))
omega = 1.0: max |x| on [0, 60] = 0.667
omega = 1.9: max |x| on [0, 60] = 5.128
omega = 2.0: max |x| on [0, 60] = 14.727
resonance envelope at t = 60: 15.0

Damped forcing: transient and steady state

With c>0c > 0 the homogeneous part decays (it is the transient), and what remains is the steady-state solution

xsp=C(ω)cos⁡(ωt−γ),C(ω)=F0m2(ω02−ω2)2+c2ω2,tan⁡γ=cωm(ω02−ω2).x_{sp} = C(\omega)\cos(\omega t - \gamma), \qquad C(\omega) = \frac{F_0}{\sqrt{m^2(\omega_0^2 - \omega^2)^2 + c^2\omega^2}}, \qquad \tan\gamma = \frac{c\omega}{m(\omega_0^2 - \omega^2)}.

The amplitude C(ω)C(\omega) is the frequency response. For small damping it has a sharp peak near ω0\omega_0 (practical resonance), at ω=ω02−c22m2\omega = \sqrt{\omega_0^2 - \frac{c^2}{2m^2}} when c2<2mkc^2 < 2mk.

python · try it yourself
import numpy as np

m, k, F0 = 1.0, 4.0, 1.0
C = lambda w, c: F0 / np.sqrt(m**2 * (k / m - w**2)**2 + c**2 * w**2)
for c in (0.2, 1.0, 3.0):
    ws = np.linspace(0.01, 4, 40000)
    amps = C(ws, c)
    i = np.argmax(amps)
    print(f"c = {c}: peak amplitude {amps[i]:.3f} at omega = {ws[i]:.3f} (static response {F0 / k})")
c = 0.2: peak amplitude 2.503 at omega = 1.995 (static response 0.25)
c = 1.0: peak amplitude 0.516 at omega = 1.871 (static response 0.25)
c = 3.0: peak amplitude 0.250 at omega = 0.010 (static response 0.25)

With little damping the peak is ten times the static deflection F0/kF_0/k; with c=3c = 3 (c2>2mk=8c^2 > 2mk = 8) there is no peak at all, and the largest response is at ω=0\omega = 0.

In software

  • Vibration analysis software computes frequency response curves to keep machinery and buildings away from resonance; the Tacoma Narrows and Millennium Bridge stories are the cautionary tales.
  • In game physics, stiff springs driven at the frame rate can resonate numerically; engines add damping or use implicit integrators to avoid "exploding" ragdolls.
  • Audio equalisers and resonant filters deliberately shape C(ω)C(\omega).

Exercises

Exercise 1: Steady-state amplitude

For x′′+9x=5cos⁡2tx'' + 9x = 5\cos 2t (undamped, m=1m = 1), find the particular solution.

Answer

xp=cos⁡2tx_p = \cos 2t.

Solution

F0m(ω02−ω2)=59−4=1\frac{F_0}{m(\omega_0^2 - \omega^2)} = \frac{5}{9 - 4} = 1.

Exercise 2: Resonance

For x′′+25x=10cos⁡5tx'' + 25x = 10\cos 5t, x(0)=x′(0)=0x(0) = x'(0) = 0, write the solution. How large is the amplitude at t=10t = 10?

Answer

x=tsin⁡5tx = t\sin 5t; amplitude 10 at t=10t = 10.

Solution

xp=F02mω0tsin⁡ω0t=1010tsin⁡5tx_p = \frac{F_0}{2m\omega_0}t\sin\omega_0t = \frac{10}{10}t\sin 5t. This already satisfies x(0)=0x(0) = 0 and x′(0)=0x'(0) = 0, so no homogeneous part is needed.

Exercise 3: Frequency response (code)

For m=1m = 1, k=1k = 1, c=0.1c = 0.1 and F0=1F_0 = 1, compute C(ω)C(\omega) at ω=0.5\omega = 0.5, 1 and 2.

Answer

About 1.330, 10 and 0.333.

Solution

At ω=1=ω0\omega = 1 = \omega_0 the first term vanishes and C=10.1⋅1=10C = \frac{1}{0.1 \cdot 1} = 10.

python · try it yourself
import numpy as np
C = lambda w: 1 / np.sqrt((1 - w**2)**2 + (0.1 * w)**2)
print([round(float(C(w)), 3) for w in (0.5, 1.0, 2.0)])
[1.33, 10.0, 0.333]

Test yourself

Pure resonance in x′′+ω02x=F0cos⁡ωtx'' + \omega_0^2x = F_0\cos\omega t happens when…

  1. ω=0\omega = 0
  2. ω=ω0\omega = \omega_0
  3. ω=2ω0\omega = 2\omega_0
  4. F0=0F_0 = 0

In a damped forced system, the transient is…

  1. the part that grows
  2. the homogeneous solution, which decays
  3. the steady-state solution
  4. the forcing term

Beats occur when…

  1. damping is large
  2. the forcing frequency is close to but not equal to the natural frequency
  3. there is no forcing
  4. the system is overdamped