Kinetic energy
—
A damped harmonic oscillator is one of the most useful models in physics and engineering because it turns a surprisingly wide range of real systems into the same understandable story. A car suspension, a machine mounted on rubber feet, a seismically isolated floor, a microphone diaphragm, and even an electrical RLC circuit can all be interpreted as something that wants to oscillate, but also loses energy as it moves. This calculator lets you explore that story directly. You enter a mass, a spring stiffness, a damping coefficient, optional starting conditions, and an optional sinusoidal drive. The page then precomputes the motion, animates the response on a canvas, shows how the displacement and velocity evolve, and tracks where the energy goes.
The most helpful part of a calculator like this is not just the final number at one moment in time. It is the pattern. When damping is small, the motion rings for a long time and the oscillations decay gradually. When damping is moderate, the peaks shrink faster. When damping becomes very large, the system may stop oscillating altogether and instead creep back toward equilibrium. If you add a periodic external force, you can also study resonance, which is the reason some systems react violently near a particular frequency while others remain controlled. By watching the animation and the energy bars together, you can see the same physical idea from several angles at once: the mass moves, the spring stores and releases energy, and the damper steadily removes mechanical energy from the system.
This page is meant for practical learning, quick checks, and intuition building. It uses SI units, gives immediate feedback when you change inputs, and allows CSV export for deeper analysis in spreadsheets or code. If you are a student, the calculator can help connect textbook formulas to visible motion. If you are an engineer or hobbyist, it offers a fast way to test how sensitive a design is to stiffness, damping, or forcing frequency before moving on to a more detailed model.
The simulator uses the standard linear mass-spring-damper equation with optional sinusoidal forcing. In plain language, the mass resists acceleration, the spring pulls toward equilibrium, the damper resists velocity, and the external force can keep feeding energy into the motion. The governing equation is
Here is the mass in kilograms, is the spring constant in newtons per meter, is the viscous damping coefficient in kilograms per second, is displacement in meters, and is velocity in meters per second. The drive force is entered through . If the forcing amplitude is zero, the motion is free vibration determined only by the initial conditions. If the forcing amplitude is nonzero, the motion becomes forced vibration and the relationship between the drive frequency and the natural frequency starts to matter a great deal.
The natural frequency tells you how quickly the system would oscillate if there were no damping and no forcing, while the damping ratio classifies the shape of the response. That classification is often the quickest way to understand what you are seeing on the screen:
Three related formulas are useful when you want a little more intuition without diving into a full vibration textbook. The decay rate of the free response is often written as . In the lightly damped case, the envelope of the oscillation follows , which is why the peaks get smaller in a smooth exponential way rather than dropping by a fixed amount every cycle. For forced vibration with light damping, the resonant response tends to occur near , which helps explain why damping shifts and softens the peak rather than simply shrinking every motion equally.
The calculator assumes a single moving degree of freedom. The position is measured relative to the equilibrium location, written as . You can set the starting state with the initial displacement and initial velocity . Air resistance, seal friction, material hysteresis, and other losses are all represented by the single coefficient , so this is intentionally a simplified linear model. The time step controls the numerical integration. Smaller steps usually improve accuracy, especially when the system is stiff or the forcing varies rapidly.
For the actual computation, the simulator rewrites the motion as a first-order system. Newton's second law is evaluated as
, with the kinematic relation . That gives the pair
, . The page also follows the energy flow using for kinetic energy, for spring energy, and for dissipated power. The cumulative work supplied by the forcing is written as , so the simulation can monitor the energy-balance expression .
The numerical scheme is a classical fourth-order Runge-Kutta method. With each step of size , the code samples the derivatives several times and combines them through
That method is accurate enough for an interactive page, and its local error scales with . In practice, that means a smaller step can greatly improve the quality of the motion and the energy accounting. If you choose very large or very large , keep an eye on the result and consider reducing if the response looks jagged or unstable.
Start by choosing the physical properties of the oscillator. Mass controls inertia, so larger mass usually means slower motion. Spring constant controls stiffness, so larger values raise the natural frequency and make the system resist displacement more strongly. Damping coefficient sets how aggressively energy is removed. Initial displacement and initial velocity tell the simulator how much spring energy and kinetic energy are present at the start. If you leave the forcing amplitude at zero, you are studying free decay. If you enter a nonzero forcing amplitude and a drive frequency, you are asking how the oscillator responds to continuous sinusoidal input.
Once the parameters look right, press Play to animate the precomputed solution, Pause to stop, and Reset to jump back to the initial state. The status line reports whether the simulation is ready, and the figure caption reports the current time, displacement, velocity, and energy-balance error. The three progress bars give a fast visual sense of where the energy is at that moment: kinetic energy peaks near the equilibrium crossing, spring energy peaks near the turning points, and dissipated energy grows steadily as the damper does work. The CSV button exports the sampled trajectory, which is useful if you want to make your own plots, compute spectra, or compare several parameter sets in Python, MATLAB, Excel, or another tool.
If you are interpreting the result for design or study, do not focus only on one peak. Look for a pattern over time. Ask whether the displacement envelope decays, whether it settles without overshoot, whether forcing produces a persistent steady-state amplitude, and whether the energy-balance error remains small. Those questions matter because they separate genuine physical behavior from numerical artifacts. A stable, well-chosen step size should give a smooth curve and a tiny energy mismatch. The table below summarizes the usual damping regimes so you can connect the value of to the shape of the response you see on the page.
| 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 |
Suppose you model a 1 kg mass attached to a spring with k = 20 N/m and damping c = 0.5 kg/s. Let the starting conditions be a 0.1 m displacement and zero initial velocity, with no external forcing. The calculator then gives
That damping ratio is much less than one, so the system is clearly underdamped. In other words, the mass oscillates back and forth while the envelope decays slowly. You can write the entered values directly as , , , and . If you run that case with , the animation shows the block pass through equilibrium repeatedly while the dissipated-energy bar rises. The envelope decay is associated with the time constant , which equals about 4 s for this example. The oscillation frequency is slightly lower than the undamped natural frequency; one common expression for the damped natural frequency is . In this section that symbol refers to the damped natural frequency, not the user-entered drive frequency.
To see resonance, keep the same mass and spring but turn on forcing with a nonzero amplitude. Then choose a drive frequency close to the natural frequency. The transient response may still decay, but a steady-state oscillation will remain because the external force keeps adding energy. In a lightly damped system the steady-state amplitude can become large near resonance. If you raise the damping coefficient, the resonant peak drops and broadens. That is why damping is so important in real products: it may not change the equilibrium position, but it strongly changes how violently a system responds to disturbance and forcing.
This calculator is intentionally simple and educational. It assumes a linear spring, linear viscous damping, a single moving coordinate, constant parameters, and small enough motion that geometric nonlinearities do not matter. Real components can depart from those assumptions in several ways. Dry friction is not the same as viscous damping. Rubber mounts can have frequency-dependent losses. Springs may stiffen, soften, or bottom out. Structures can have multiple modes that couple together. External forcing may be irregular rather than perfectly sinusoidal. None of those effects are captured here. The page is best used for learning, screening, and first-pass estimates rather than certified engineering design.
Even within this linear model, numerical choices matter. Very stiff systems or very aggressive damping can require a smaller time step, and any computer model should be checked against expected scales and, when possible, analytic results. If the animation looks erratic, reduce the time step and verify your units. A mass entered in kilograms, a spring constant in newtons per meter, and damping in kilograms per second must all be physically consistent. For related explorations, you may also want to compare a pure spring case in the Mass-Spring Oscillation Calculator, an electrical analogy in the RLC Circuit Damping Calculator, or motion without spring restoring force in the Projectile Motion Calculator.
—
—
—
React to changing drive frequencies by dialing in damping fast enough to keep the steady-state amplitude below the damage threshold. Each round turns the frequency-response formula into an arcade-style challenge. Use pointer dragging on the slider, or use the arrow keys while the page is active.