Damped harmonic oscillator simulator for a mass-spring-damper released from rest. Solves m x'' + c x' + k x = 0 in closed form for the three damping regimes: underdamped (ζ < 1, decaying oscillation), critically damped (ζ = 1, fastest non-oscillating return), and overdamped (ζ > 1, slow non-oscillating return). Adjust mass, spring stiffness and damping coefficient to change the natural frequency ω₀ and damping ratio ζ, and watch the animated spring-mass system settle alongside a live displacement-vs-time chart with the exponential decay envelope overlaid.
A mass on a spring with friction is one of the most useful models in physics because two forces fully describe it. The spring supplies a restoring force proportional to displacement, F = −kx (Hooke's law), always pulling the mass back toward equilibrium. A damper — a dashpot, air resistance, internal friction — supplies a force proportional to velocity, F = −cx', always opposing motion. Newton's second law then gives m x'' + c x' + k x = 0, or equivalently x'' + 2ζω₀x' + ω₀²x = 0, where ω₀ = √(k/m) is the natural frequency the mass would oscillate at with no damping, and ζ = c / (2√(km)) is the damping ratio.
The single number ζ decides everything about the qualitative motion, regardless of the specific m, k and c values that produce it. When ζ < 1 (underdamped) the system overshoots equilibrium and oscillates with an exponentially shrinking amplitude — a lightly damped guitar string or bell rings this way. When ζ = 1 (critically damped) the system returns to equilibrium in the shortest possible time without any overshoot — many door closers and some vehicle suspensions are tuned close to this point. When ζ > 1 (overdamped) the system crawls back to equilibrium slowly, also without oscillating, as in a heavily damped hydraulic closer. Car shock absorbers are deliberately engineered near critical damping: too little damping (ζ small) and the car bounces after every bump; too much (ζ large) and the suspension feels stiff and slow to settle. This simulation solves the governing equation in closed form for each regime and shows the exact analytic solution — no numerical drift, and continuous behaviour as ζ crosses 1.
What do the controls change?
Mass m (0.1–5 kg) and stiffness k (1–200 N/m) set the natural frequency ω₀ = √(k/m) — how fast the system would oscillate with no friction. Damping c (0–30 N·s/m) sets how strongly velocity is resisted. Together they determine the damping ratio ζ = c/(2√(km)), the single number that decides whether the motion is underdamped, critically damped or overdamped. Reset restarts the motion from t = 0 with the current settings.
What is natural frequency ω₀?
ω₀ = √(k/m) is the angular frequency the mass-spring pair would oscillate at if there were no damping at all (c = 0). It depends only on stiffness and mass — a stiffer spring or a lighter mass both raise ω₀. Damping never changes ω₀ itself; it only changes how quickly oscillations at (or near) that frequency die out, and, for strong damping, whether the system oscillates at all.
Why does the chart show dashed lines?
The dashed amber curves are the envelope ±A(t) = ±x₀e^(−ζω₀t), the exponential boundary that the oscillation's peaks trace out. They are drawn only in the underdamped case, where the motion genuinely oscillates inside that shrinking envelope. For critical and overdamped motion there is no oscillation to bound, so no envelope is shown.
The damping ratio ζ = c/(2√(km)) is a dimensionless number that compares the actual damping to the "critical" amount needed to just barely prevent oscillation. It matters because it — not the individual values of m, k or c — determines the qualitative shape of the motion: oscillating and decaying (ζ < 1), returning as fast as possible with no overshoot (ζ = 1), or returning slowly with no overshoot (ζ > 1). Any combination of mass, stiffness and damping that produces the same ζ behaves the same way, just on a different time scale set by ω₀.
Both return to equilibrium without oscillating, but critically damped (ζ = 1) does so in the least possible time — it is the fastest non-oscillating response achievable for that natural frequency. Overdamped (ζ > 1) has so much friction that the motion is slowed down further; it still never overshoots, but it takes noticeably longer to settle than the critically damped case with the same ω₀. Mathematically, critical damping is the boundary where the two decaying-exponential terms of the overdamped solution merge into a single repeated root.
A suspension with too little damping (underdamped) keeps bouncing after every pothole, which feels bouncy and unsettles tyre grip. One with too much damping (overdamped) absorbs bumps but transmits harshness because it resists motion too strongly and settles sluggishly. Tuning the shock absorber so ζ sits near 1 gives the fastest possible settle with minimal or no overshoot — a good compromise between comfort and control, which is why most passenger-car dampers are designed close to, though often slightly below, critical damping.
In the underdamped regime the period is T = 2π/ω_d, where ω_d = ω₀√(1 − ζ²). As ζ grows toward 1, ω_d shrinks toward zero, so the period stretches out longer and longer — the system oscillates more and more slowly as damping approaches the critical value. Once ζ reaches 1, ω_d becomes zero and the concept of a period stops applying altogether: the motion no longer crosses equilibrium more than once, so there is nothing left to measure a period between.
No — damping does not destroy energy, it converts mechanical energy into heat through friction, viscous drag or internal material losses, exactly as ordinary friction does elsewhere in physics. Total energy (mechanical plus thermal) is still conserved; what decreases is only the mechanical energy stored in the spring and the moving mass, which is why the oscillation amplitude shrinks over time instead of continuing forever.
It assumes an idealised linear spring (force exactly proportional to displacement) and linear viscous damping (force exactly proportional to velocity), both constant regardless of amplitude. Real systems can have nonlinear stiffness at large displacement, dry (Coulomb) friction that doesn't scale with speed, temperature-dependent damping, or a mass with its own internal flexibility. The simulator also releases the mass from rest at a fixed initial displacement rather than letting you set an initial velocity.