mass_spring_damper.py

Created by vnap0v

Created on June 19, 2025

1.37 KB

Mass-Spring-Damper

This script plots a solution for the dampened mass-spring system using a simple Euler method. The second degree ODE has to be modified into two first order ODEs.

d²x/dt²+ 2*ζ*ωn*dx/dt + ωn²*x = 0
v = dx/dt

=> dv/dt + 2*ζ*ωn*v + ωn²*x = 0

=> dv/dt = -2*ζ*ωn*v - ωn²*x
   dx/dt = v

 ωn = sqrt(k/m)
 ζ = c/(2*m*ωn)
  • Undamped systems ζ = 0
  • Underdamped systems ζ < 1
  • Critically damped systems ζ = 1
  • Overdamped systems ζ > 1

The script uses matplotlib for plotting.


During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.