Skip to content
Tutorials Center
My learning

Topics

Lesson 38 of 39 · Projects and Practice

Project: Driven Oscillators and Resonance

Explore a forced, damped oscillator: the steady-state amplitude formula, resonance peak, beats, quality factor and the RLC circuit analogy, checked against numerical simulation.

Push a child on a swing at the right rhythm and a gentle push builds a huge motion. Push at the wrong rhythm and nothing happens. That is resonance, the phenomenon behind musical instruments, radio tuners, MRI scanners, microwave ovens and, in the unlucky case, bridge collapses. The model is a mass on a spring with damping and a periodic force, and it is the best example of a linear second-order ODE with forcing.

In this project you derive the steady-state response, test the formula against a simulation, and measure the quantities engineers use: peak frequency, bandwidth and the quality factor Q.

The model

TEXT
x'' + 2ζω0 x' + ω0² x = F cos(ωt)

ω0 = sqrt(k/m) is the natural frequency, ζ the damping ratio (ζ < 1 is underdamped) and F the force per unit mass at driving frequency ω. The solution is the sum of a transient (the homogeneous solution, which decays like e^{-ζω0 t}) and a steady state (a particular solution that oscillates at the driving frequency forever).

For the steady state try x_p = A cos(ωt - φ). Substituting gives

TEXT
A(ω) = F / sqrt( (ω0² - ω²)² + (2ζω0 ω)² ),     tan φ = 2ζω0 ω / (ω0² - ω²)

The amplitude depends only on the frequency ratio and damping, not on the initial conditions, which only affect the transient. For small damping the amplitude peaks near ω0; the maximum is at ω_peak = ω0 sqrt(1 - 2ζ²) (it exists when ζ < 1/sqrt 2), where A_max ≈ F/(2ζω0²) for small ζ. Halve the damping and the peak doubles.

Python Formula versus simulation

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

After the transient has died out, the two columns agree. Near ω = 2 the amplitude is about 1.25, five times the static displacement F/ω0² = 0.25 (the response to a force that does not oscillate). That ratio of peak response to static response is the quality factor Q ≈ 1/(2ζ) = 5 for this damping.

Quality factor and bandwidth

Q measures how sharp the resonance is. Two equivalent descriptions:

  • Q ≈ 1/(2ζ): low damping, high Q.
  • Q ≈ ω0/Δω, where Δω is the bandwidth: the width of the peak between the points where the power (amplitude squared) drops to half its maximum, i.e. the amplitude falls by 1/sqrt 2.

A radio receiver is a resonant circuit with high Q: it responds strongly to its tuned station and ignores neighbors. A shock absorber has low Q on purpose.

Python Measure Q from the half-power bandwidth

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The two estimates of Q agree better and better as the damping decreases.

Undamped resonance and beats

With no damping (ζ = 0) and ω ≠ ω0, starting from rest, the solution is a sum of two cosines:

TEXT
x(t) = F/(ω0² - ω²) (cos ωt - cos ω0 t) = (2F/(ω0² - ω²)) sin((ω0 - ω)t/2) sin((ω0 + ω)t/2)

When ω is close to ω0 the fast oscillation at the average frequency is slowly modulated by a long envelope with period 4π/|ω0 - ω|: beats. Piano tuners listen for them. At exactly ω = ω0 the formula degenerates: the particular solution is (F/(2ω0)) t sin(ω0 t), an oscillation whose amplitude grows linearly without bound: pure resonance.

Python Beats and pure resonance

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Real systems always have some damping, so the amplitude levels off at the finite value A(ω0) = F/(2ζω0²). Without damping (or with damping too small) structures break first.

Forced oscillator vocabulary

Natural frequency What the system does on its own.
Damping ratio Sets decay and peak height.
Resonance Driving near the natural frequency.
Q factor Natural frequency over bandwidth.

Transient dies out; the steady state follows the driver.

1 / 2

The electrical twin: the RLC circuit

An inductor L, resistor R and capacitor C in series driven by a voltage V cos ωt obey L q'' + R q' + q/C = V cos ωt, where q is the charge. It is the same equation with the dictionary: mass ↔ inductance, damping ↔ resistance, spring constant ↔ 1/C, displacement ↔ charge, ω0 = 1/sqrt(LC), Q = (1/R) sqrt(L/C). Once you master one, you have mastered the other, and also acoustics, optics and mechanical vibrations.

Extensions to try

  • Make the spring nonlinear (Duffing: add β x³) and see the amplitude curve bend over and jump.
  • Add a second mass (two coupled oscillators have two resonances; use a 4D first-order system).
  • Drive with a square wave instead of a cosine: its Fourier series contains harmonics, and each one can excite a resonance.
  • Add a swept (chirp) frequency and watch the response build up and decay.

Common mistakes

  • Plotting the amplitude before the transient has died out.
  • Confusing the peak of the amplitude curve (ω0 sqrt(1 - 2ζ²)) with ω0 or with the damped natural frequency ω0 sqrt(1 - ζ²); they differ slightly.
  • Forgetting that the phase lag flips from 0 to π as the driving frequency crosses ω0.
  • Using too coarse a grid when searching for a sharp resonance peak.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. The steady-state response of a damped, driven oscillator depends on:

    The transient carries the initial conditions and decays; the steady state depends only on the forcing and system parameters.
  2. 2. If the damping ratio is halved, the resonance peak amplitude roughly:

    A_max ≈ F/(2ζω0²), so it is inversely proportional to ζ.
  3. 3. Undamped forcing exactly at ω0 leads to amplitude growing:

    The particular solution is (F/(2ω0)) t sin(ω0 t).
  4. 4. The quality factor Q is approximately:

    Low damping means high Q, with Q ≈ 1/(2ζ) and also ≈ ω0/bandwidth.

Summary

  • A driven damped oscillator has a decaying transient plus a steady state at the driving frequency.
  • The steady-state amplitude is F / sqrt((ω0² - ω²)² + (2ζω0ω)²), peaking near ω0 for light damping.
  • Q ≈ 1/(2ζ) ≈ ω0/bandwidth quantifies resonance sharpness.
  • Undamped driving near ω0 gives beats; exactly at ω0 the amplitude grows linearly.
  • RLC circuits obey the same equation, so every result transfers.

Next: Practice Problems with Solutions