Oscillator kinetic energy
—
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.
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
Here is mass in kilograms, is spring constant in newtons per meter, is viscous damping coefficient in kilograms per second, is displacement in meters, and is velocity in meters per second. The entered forcing is . 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.
For this mass-spring-damper model, natural frequency is the undamped, unforced oscillation rate, while damping ratio identifies the response shape:
Several related quantities help interpret the oscillator response. The free-response decay rate is . For an underdamped free response, the envelope can be written , so successive peaks shrink exponentially. With light damping and sinusoidal forcing, the resonance peak tends to occur near ; 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 . Initial displacement and initial velocity set the starting state. Air resistance, seal friction, material losses, and similar effects are represented by the single viscous coefficient , making this a deliberately simplified linear model. The time step 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
, with the kinematic relation . Thus the integrator advances
, . It also displays kinetic energy , spring energy , and damping power . 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 and step , it combines derivative samples as
For this interactive damped harmonic oscillator calculation, the method's local error scales with . Reducing the time step can improve the quality of fast or stiff motion and the energy accounting. When using large or large , check whether a smaller produces a smoother, more reliable response.
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.
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 |
Consider the calculator's default free-vibration setup: a 1 kg mass, spring constant N/m, damping coefficient kg/s, initial displacement m, zero initial velocity, and zero forcing amplitude. The natural frequency and damping ratio are
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 , and it is gradually transferred into kinetic energy and then dissipated by the damper. With 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 . Its damped natural frequency is slightly below the undamped value: . In this formula, 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 reduces and broadens the resonance peak. This comparison demonstrates why damping affects disturbance response even though it does not alter the equilibrium location.
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.
—
—
—
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.