Spring-Mass Force Lab (3D)

A cart on a rail: spring, damping, friction, incline and a driving force, with live force arrows and energy accounting.

Switch to 2D

Presets

Playback

System

Surface

Driver

Start and speed

Camera

Layers

Quality

Model check

The science

What is modelled

A cart of mass m slides on a rail and is held by an ideal (massless, linear) spring. The motion is one-dimensional along the rail. You can add viscous damping (air or oil), sliding Coulomb friction, tilt the rail, and push the cart with a sinusoidal driving force. Every number on screen is computed from the equation of motion below, not drawn by hand.

Equations

  • Equation of motion: m x'' = -k x - c v - m g sin(a) - mu m g cos(a) sgn(v) + F0 cos(2 pi f t), with x = 0 where the spring has its natural length.
  • Natural frequency f0 = (1/2pi) sqrt(k/m), damping ratio zeta = c / (2 sqrt(k m)): under 1 the cart rings, over 1 it creeps back without overshoot, and at exactly 1 it returns fastest without overshoot.
  • Steady driven amplitude: A = F0 / sqrt((k - m w^2)^2 + (c w)^2), w = 2 pi f. Without damping it grows without bound at f = f0; with damping the peak is finite and sits slightly below f0.
  • Energy: E = m v^2/2 + k x^2/2 + m g sin(a) x. The balance E = E0 + W_driver - heat_damping - heat_friction is tracked step by step (the dashed green line in the energy graph).
  • Integration: velocity Verlet with a 2 ms step; static friction holds the cart when the net non-friction force is no larger than mu m g cos(a).

Checks run in this page

  • Period: a private undamped run must measure 2 pi sqrt(m/k) within 0.2 %.
  • Closed form: a damped free run is compared with x0 e^(-g t)(cos wd t + g/wd sin wd t) at 2.5 s.
  • Resonance: a driven run, after its transient, is compared with the amplitude formula above (within 1 %).
  • Energy ledger: a private run with friction, incline and a driver, and also the live page, must satisfy the work-energy balance.

Honest simplifications

  • Spring mass is ignored and the spring never saturates or buckles; rolling wheels are modelled only through the friction coefficient and the viscous term.
  • Real air drag is closer to v^2 than to v; linear damping is chosen because it has the exact closed forms used in the checks.
  • Coulomb friction uses one coefficient for static and sliding contact.
  • The coloured arrows are scaled for readability (0.012 m per newton, capped).
Loading model...
Loading Blender model...
Position and velocity against time
Energy: kinetic, potential, heat, ledger
Resonance curve (steady amplitude against driver frequency)
Made with 🟠 Blender · Three.js