Damped Harmonic Oscillator Calculator

Introduction to damped harmonic oscillator motion

A damped harmonic oscillator describes a mass that is pulled toward equilibrium by a spring while a damper removes energy as it moves. The same basic behavior appears in a vehicle suspension, a machine on compliant mounts, a microphone diaphragm, and the electrical analogue of an RLC circuit. This calculator lets you examine that behavior directly: enter mass, spring stiffness, damping, starting displacement and velocity, plus an optional sinusoidal drive. It precomputes the motion, animates the mass-spring response, reports displacement and velocity, and tracks the mechanical energy associated with the simulated trajectory.

The useful result here is the evolving response rather than a single isolated value. With little damping, a displaced mass rings for many cycles before its oscillations fade. Increasing the viscous damping makes the peaks diminish more quickly. Sufficiently strong damping removes the oscillation entirely, leaving a gradual return toward equilibrium. A periodic force adds another important effect: near an appropriate drive frequency, continued energy input can sustain a large response. The animation and energy indicators show the same process from complementary viewpoints—the mass moves, the spring alternately stores and releases energy, and the damper converts mechanical energy into dissipated energy.

This damped oscillator simulator is intended for quick physical checks and for building intuition with SI-unit inputs. It recalculates when parameters change and can export the sampled time series as CSV for plotting or further work. Students can connect differential-equation terms to visible motion, while engineers and hobbyists can compare the effects of stiffness, damping, and forcing frequency before using a more detailed model.

Damped oscillator model, formulas, and input meanings

This damped harmonic oscillator simulation uses the linear mass-spring-damper equation with an optional sinusoidal force. The mass resists acceleration, the spring acts toward equilibrium, the damper opposes velocity, and the applied force may continuously add energy. The governing equation is

m d2x dt2 + c dx dt + k x = F0 sin ( ωd t )

Here m is mass in kilograms, k is spring constant in newtons per meter, c is viscous damping coefficient in kilograms per second, x is displacement in meters, and v is velocity in meters per second. The entered forcing is F(t)=F0sin(ωdt). A zero forcing amplitude produces free vibration set by the initial state. A nonzero amplitude produces forced vibration, so the drive frequency becomes important relative to the system's natural frequency.

ωn = km , ζ = c2mk

For this mass-spring-damper model, natural frequency ωn is the undamped, unforced oscillation rate, while damping ratio ζ identifies the response shape:

  • ζ<1: underdamped motion oscillates while its amplitude decays over time.
  • ζ=1: critically damped motion returns to equilibrium as quickly as possible without oscillating.
  • ζ>1: overdamped motion returns without oscillation but more slowly than the critically damped case.

Several related quantities help interpret the oscillator response. The free-response decay rate is α=c2m. For an underdamped free response, the envelope can be written xenv(t)=Ce-αt, so successive peaks shrink exponentially. With light damping and sinusoidal forcing, the resonance peak tends to occur near ωrωn1-2ζ2; damping therefore changes both the height and location of the peak.

The simulated mass has one moving degree of freedom, and its position is measured from the equilibrium point x=0. Initial displacement x0 and initial velocity v0 set the starting state. Air resistance, seal friction, material losses, and similar effects are represented by the single viscous coefficient c, making this a deliberately simplified linear model. The time step Δt sets the numerical integration interval; smaller values generally improve the sampled response when stiffness or forcing frequency is high.

For the numerical motion calculation, the oscillator equation is expressed as a first-order system. Newton's second law is evaluated as

mdvdt=F(t)-cv-kx, with the kinematic relation dxdt=v. Thus the integrator advances

dxdt=v, dvdt=F(t)-cv-kxm. It also displays kinetic energy Ek=12mv2, spring energy Ep=12kx2, and damping power Pd=cv2. The displayed energy-balance error compares those energies and the accumulated damping loss against the initial energy plus the numerically accumulated forcing work.

The damped oscillator trajectory is integrated with the classical fourth-order Runge-Kutta method. For a state s and step Δt, it combines derivative samples as

s(t+Δt)=s(t)+Δt6(k1+2k2+2k3+k4)

For this interactive damped harmonic oscillator calculation, the method's local error scales with Δt5. Reducing the time step can improve the quality of fast or stiff motion and the energy accounting. When using large k or large c, check whether a smaller Δt produces a smoother, more reliable response.

Using the damped harmonic oscillator calculator and reading its results

Begin this damped oscillator simulation by selecting the physical properties of the moving system. Mass sets inertia, so greater mass generally lowers the natural frequency. Spring constant sets stiffness and increases the restoring force for a given displacement. Damping coefficient determines how strongly motion loses energy. Initial displacement and velocity establish the spring and kinetic energy present at time zero. Leaving forcing amplitude at zero examines free decay; supplying a nonzero amplitude and drive frequency examines the response to continued sinusoidal excitation.

  • Mass (m, kg) changes how hard the system is to accelerate.
  • Spring constant (k, N/m) sets stiffness and influences natural frequency.
  • Damping coefficient (c, kg/s) controls how quickly oscillations die out.
  • Initial displacement and velocity define the starting state.
  • Forcing amplitude F₀ and drive frequency ωd create steady-state forcing and resonance effects.
  • Time step Δt balances smoothness, numerical stability, and speed.

After setting the oscillator parameters, press Play to animate the precomputed trajectory, Pause to stop it, and Reset to return to the initial state. The caption reports time, displacement, velocity, and the energy-balance error. The three progress bars indicate kinetic, spring potential, and accumulated dissipated energy relative to the largest tracked total. Kinetic energy is greatest near an equilibrium crossing, spring energy is greatest near a turning point, and dissipated energy accumulates as the damper acts. The CSV button downloads the sampled trajectory for use in a spreadsheet or analysis program.

When studying a damped harmonic oscillator, interpret the trend over time rather than only the first peak. Check whether the displacement envelope decays, whether the system returns without overshoot, and whether a nonzero drive leaves a persistent steady-state amplitude. Also watch the displayed energy-balance error: a small value is a useful numerical check, while an erratic motion or substantial mismatch suggests trying a smaller time step or reviewing the entered units. The damping-regime table connects ζ to the response shape shown by the simulation.

Regime Damping ratio What you usually see Typical examples
Underdamped 0 < ζ < 1 Oscillations with a shrinking envelope Lightly damped structures, instruments, many suspensions
Critically damped ζ = 1 Fast return to equilibrium without overshoot Positioning systems, some control applications
Overdamped ζ > 1 No oscillation, but a slower return than the critical case Strong shock isolation or deliberately sluggish motion

Worked example: free decay of a lightly damped mass-spring system

Consider the calculator's default free-vibration setup: a 1 kg mass, spring constant k=20 N/m, damping coefficient c=0.5 kg/s, initial displacement x0=0.1 m, zero initial velocity, and zero forcing amplitude. The natural frequency and damping ratio are

  • ωn=2014.47 rad/s
  • ζ=0.521200.056

Because this damping ratio is well below one, the simulated mass is underdamped: it crosses equilibrium repeatedly while its displacement envelope decreases. The starting spring energy is 12kx02=0.1 J, and it is gradually transferred into kinetic energy and then dissipated by the damper. With Δt=0.02 s, the animation makes this exchange visible as the block moves through equilibrium and the dissipated-energy value rises. The exponential envelope time constant is τ=2mc=4 s. Its damped natural frequency is slightly below the undamped value: ωd=km-c24m2. In this formula, ωd denotes damped natural frequency, whereas the form field uses the same subscript for the applied drive frequency.

To explore forced damped motion from this baseline, enter a nonzero forcing amplitude and choose a drive frequency near the natural frequency. The free transient still diminishes, but the driving force can leave a continuing oscillation. In a lightly damped system, that steady response can grow substantially near resonance; increasing c reduces and broadens the resonance peak. This comparison demonstrates why damping affects disturbance response even though it does not alter the equilibrium location.

Damped oscillator assumptions, limits, and sensible use

This damped harmonic oscillator calculator is a simple educational linear model. It assumes one moving coordinate, a linear spring, linear viscous damping, constant parameters, and motion small enough that geometric nonlinearities can be ignored. Actual systems may use dry friction rather than viscous damping, frequency-dependent rubber losses, nonlinear or bottoming springs, coupled vibration modes, or irregular forcing. Those effects are outside this simulation, so use it for learning, screening, and first-pass estimates rather than certified engineering design.

Numerical choices also matter in this mass-spring-damper model. Stiff systems and aggressive damping can require a shorter time step, and useful results should be checked against expected physical scales or analytical solutions when available. If the animation becomes erratic, reduce the time step and verify unit consistency: mass is kilograms, spring constant is newtons per meter, and damping is kilograms per second. For related motion problems, compare a pure spring case in the Mass-Spring Oscillation Calculator, an electrical analogue in the RLC Circuit Damping Calculator, or motion without a spring restoring force in the Projectile Motion Calculator.

Enter parameters and press Play.
Simulation summary will appear here.

Oscillator kinetic energy

Spring potential energy

Damper-dissipated energy

Damped Oscillator Resonance Arena Mini-Game

Test how viscous damping limits a forced oscillator near resonance by adjusting the damping slider before each changing drive condition. Each round uses the steady-state amplitude relation . Drag the slider with a pointer, or use the arrow keys while the page is active.

Keep oscillator amplitude inside the safe band

Click to Play, tune damping in time, and survive all 80 seconds.

Best run: 0

Embed this calculator

Copy and paste the HTML below to add the Damped Harmonic Oscillator Motion, Energy & Resonance Simulator to your website.