Physics · Intermediate

Damped driven oscillator

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

A damped driven oscillator is a mass on a spring that loses energy to friction while an external periodic force keeps pushing it. After transients die away, it oscillates at the driving frequency with an amplitude that peaks near the natural frequency, a phenomenon called resonance.

Intuition

Think of pushing a child on a swing. The swing has a preferred rhythm, its natural frequency. Friction (air drag) removes energy every cycle. If you push at the wrong rhythm, your pushes partly cancel and the motion stays small. If you push in step with the swing, each push adds energy at the right moment, and the amplitude grows until the energy you add per cycle equals the energy friction removes. Weaker damping gives a taller, narrower resonance peak. Also, the swing lags behind your push: far below resonance it moves nearly in phase with the force, at resonance it lags by a quarter cycle, and far above resonance it moves in opposition. The same maths describes tuned circuits, MRI radio-frequency coils, and the basilar membrane in the ear.

Key equations

mx¨+bx˙+kx=F0cos⁡(ωt)
(1)

Equation of motion: inertia, damping, spring force, and sinusoidal driving force.

ω0=k/m,γ=b/m
(2)

Natural angular frequency and damping rate.

A(ω)=F0/m(ω02−ω2)2+γ2ω2
(3)

Steady-state amplitude as a function of driving frequency.

tan⁡φ=γωω02−ω2
(4)

Phase lag of displacement behind the driving force.

Q=ω0/γ
(5)

Quality factor: sharpness of resonance; peak width is about gamma.

Derivation

  1. Write Newton's second law: m x'' = -kx - b x' + F0 cos(wt), then divide by m to get x'' + γx' + ω0² x = (F0/m)cos(wt).
  2. The general solution is a transient (decaying as e^{-γt/2}) plus a steady-state particular solution.
  3. Use the complex form: replace the force by (F0/m)eiωt and try x=Ceiωt.
  4. Substitute: (-w² + iγw + ω0²) C = F0/m, so C = (F0/m)/(ω0² - w² + iγw).
  5. The amplitude is A = |C|, giving the formula with the square root in the denominator.
  6. The phase is the argument of C: the displacement lags the force by φ with tanφ = γw/(ω0² - w²).
  7. Maximizing A over w gives w_res = sqrt(ω0² - γ²/2), slightly below ω0 and existing only if damping is light.

Worked example

Problem

A mass of 0.50 kg on a spring of k=200 N/m has damping b=2.0 kg/s and is driven by F0=4.0 N at the natural frequency. Find the steady-state amplitude and Q.

  1. ω0=200/0.50=400=20 rad/s.
  2. γ = b/m = 2.0/0.50 = 4.0 s^-1.
  3. At w=ω0 the first term in the denominator vanishes, so A=(F0/m)/(γω0).
  4. F0/m = 4.0/0.50 = 8.0 m/s².
  5. A = 8.0/(4.0 × 20) = 0.10 m.
  6. Q = ω0/γ = 20/4 = 5.

Answer Amplitude = 0.10 m (10 cm); Q = 5.

Common mistakes

  • Thinking the peak amplitude occurs exactly at ω0; with damping it is slightly lower, at sqrt(ω0² - γ²/2).
  • Confusing the natural frequency with the damped free frequency sqrt(ω0² - γ²/4); the driven system follows the driving frequency, not either of these.
  • Believing the oscillator at resonance is in phase with the force; displacement lags by 90 degrees (velocity is in phase).
  • Forgetting the transient: the steady-state formula applies only after the e^{-γt/2} term has decayed.
  • Assuming resonance amplitude is infinite; damping always keeps it finite.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

scene.py(64 lines)
import sys
import numpy as np
from manim import *
from blocks import *

M, C, K = 1.0, 0.4, 4.0
F0, WD = 1.0, 1.5
DT, T_END = 0.01, 20.0


def simulate():
    """Semi-implicit Euler for m x'' + c x' + k x = F0 cos(wd t)."""
    n = int(round(T_END / DT))
    t = np.zeros(n + 1)
    x = np.zeros(n + 1)
    v = np.zeros(n + 1)
    x[0], v[0] = 1.0, 0.0
    for i in range(n):
        a = (F0 * np.cos(WD * t[i]) - C * v[i] - K * x[i]) / M
        v[i + 1] = v[i] + a * DT
        x[i + 1] = x[i] + v[i + 1] * DT
        t[i + 1] = t[i] + DT
    return t, x, v


T, X, V = simulate()


class Main(Scene):
    def construct(self):
        TitleCard(self, "Damped driven oscillator", "m x'' + c x' + k x = F cos(wt)")
        # axes and computed curve (subsampled)
        idx = np.arange(0, len(T), 10)
        plot = CurvePlot(lambda s: float(np.interp(s, T, X)), x_range=(0, 20, 5),
                         y_range=(-1.5, 1.5, 0.5), x_label="t", y_label="x",
                         color=C_MAIN, x_length=9.0, y_length=4.0)
        plot.move_to(ORIGIN + 0.1 * DOWN)
        pts = [plot.axes.c2p(T[i], X[i]) for i in idx]
        curve = VMobject(color=C_MAIN, stroke_width=3).set_points_as_corners(pts)
        self.play(Create(plot.axes), FadeIn(plot.labels))
        eq = MathTex(r"m\ddot x + c\dot x + kx = F_0\cos\omega t", font_size=30)
        eq.to_edge(UP, buff=1.1)
        self.play(Write(eq))
        StepCaption(self, "Transient decays, then the system follows the drive")
        self.play(Create(curve), run_time=6, rate_func=linear)
        # mark steady-state amplitude
        amp = np.max(np.abs(X[int(15 / DT):]))
        line = DashedLine(plot.axes.c2p(0, amp), plot.axes.c2p(20, amp), color=C_ACCENT)
        lab = Text(f"steady amplitude = {amp:.2f}", font_size=24, color=C_ACCENT)
        lab.next_to(plot.axes, UP, buff=0.1).shift(2.5 * RIGHT)
        self.play(Create(line), FadeIn(lab))
        self.wait(1)
        StepCaption(self, "Steady amplitude is set by the drive, not the start")
        self.wait(1.5)


if __name__ == "__main__" and "--selftest" in sys.argv:
    assert abs(X[0] - 1.0) < 1e-12 and abs(V[0]) < 1e-12
    # analytic steady-state amplitude
    A = F0 / np.sqrt((K - M * WD**2) ** 2 + (C * WD) ** 2)
    sim_amp = np.max(np.abs(X[int(15 / DT):]))
    assert abs(sim_amp - A) / A < 0.15, (sim_amp, A)
    assert np.all(np.isfinite(X))
    print("ok", sim_amp, A)

The Manim scene code that draws this lesson's animation in the Signals AI app (Python, Manim Community).

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.