Skip to content

Spring-Mass System Simulation

Learning Objectives

By the end of this lecture, you should be able to:

  1. Model spring-mass systems with and without damping
  2. Calculate natural frequency and understand resonance
  3. Simulate forced vibrations and frequency response
  4. Analyze the effects of damping on system behavior
  5. Apply these concepts to real engineering problems

The Physical System

A spring-mass system consists of a mass m connected to a spring with stiffness k, often with some damping c.

Spring-Mass System

Key Variables:

  • x: Displacement from equilibrium
  • m: Mass (kg)
  • k: Spring constant (N/m)
  • c: Damping coefficient (N⋅s/m)
  • F(t): External forcing function

Mathematical Models

Undamped System:

Natural frequency:

Period:

Building the Simulation

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
# System parameters
m = 1.0 # Mass (kg)
k = 10.0 # Spring constant (N/m)
c = 0.5 # Damping coefficient (N⋅s/m)
# Initial conditions
x0 = 0.1 # Initial displacement (m)
v0 = 0.0 # Initial velocity (m/s)
# Time parameters
dt = 0.01
t_max = 10
time = np.arange(0, t_max, dt)
# Calculate natural frequency
omega_n = np.sqrt(k/m)
print(f"Natural frequency: {omega_n:.2f} rad/s")
print(f"Natural period: {2*np.pi/omega_n:.2f} s")

Interactive Spring-Mass System

Controls

⚡ External Force

F(t) = 0.0 × cos(1.0t)

System Properties

Natural Frequency:3.16 rad/s
Damping Ratio:0.079
Behavior:Underdamped
Damped Frequency:3.15 rad/s
Current State
Position:0.100 m
Velocity:0.000 m/s
Energy:0.000 J
Time:0.0 s

Try this: Set damping to 0 for pure oscillation, or match forcing frequency to natural frequency for resonance!

System Behavior Types

Underdamped (ζ < 1)

System oscillates with decreasing amplitude. Common in musical instruments and some vehicle suspensions.

Critically Damped (ζ = 1)

Fastest return to equilibrium without overshoot. Ideal for door closers and some control systems.

Overdamped (ζ > 1)

Slow return to equilibrium without oscillation. Used in heavy machinery mounts.

Resonance

When forcing frequency equals natural frequency, amplitude becomes very large. Must be avoided in structures.

Real-World Applications

Car Suspension System

Vehicle Suspension Analysis

A car’s suspension can be modeled as a spring-mass system. Given:

  • Vehicle mass: m = 1500 kg
  • Spring constant: k = 30,000 N/m
  • Damping coefficient: c = 3000 N⋅s/m

Calculate the natural frequency and damping ratio.

Solution

Natural frequency:

Natural period:

Damping ratio:

Since ζ < 1, the system is underdamped and will oscillate with decreasing amplitude.

Frequency Response Analysis

Add this code to explore how the system responds to different forcing frequencies:

# Frequency sweep
frequencies = np.logspace(-1, 2, 100) # 0.1 to 100 rad/s
amplitudes = []
for omega in frequencies:
r = omega / omega_n
zeta = c / (2 * np.sqrt(k * m))
# Steady-state amplitude
amplitude = 1 / np.sqrt((1 - r**2)**2 + (2*zeta*r)**2)
amplitudes.append(amplitude)
plt.figure()
plt.loglog(frequencies/omega_n, amplitudes)
plt.xlabel('Frequency Ratio (ω/ωₙ)')
plt.ylabel('Amplitude Ratio')
plt.title('Frequency Response')
plt.grid(True)
plt.show()

Assignment

Earthquake Simulation

Model a building as a spring-mass system subjected to earthquake motion:

  1. Use ground acceleration data as input force
  2. Calculate building response for different damping values
  3. Find the damping ratio that minimizes maximum displacement
  4. Plot the frequency response and identify resonant frequencies

Parameters:

  • Building mass: 10⁶ kg
  • Stiffness: 10⁸ N/m
  • Variable damping coefficient

Key Takeaways

  • Natural frequency depends only on mass and stiffness
  • Damping controls how quickly oscillations decay
  • Resonance occurs when forcing frequency equals natural frequency
  • Phase portraits show energy in the system
  • Frequency response reveals system behavior across all frequencies

Next Steps

With these fundamentals, you can now model more complex systems like:

  • Multi-degree-of-freedom systems
  • Nonlinear springs
  • Active vibration control
  • Coupled oscillators

Comments

© 2021-2025 SiliconWit. All rights reserved.