Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

2. SDOF Systems — Forced Vibration & the Frequency Response Function

ISAE-SUPAERO

Solved reference notebook. See 02_SDOF_ForcedVibration_FRF_Exercises.ipynb for the blanked-out version.

import numpy as np
import matplotlib.pyplot as plt
import sympy as sp
import control
from scipy.integrate import solve_ivp

plt.rcParams["figure.figsize"] = (7, 4.2)
plt.rcParams["axes.grid"] = True

2.1 Transfer function and Frequency Response Function (FRF)

For a SDOF system with viscous damping subjected to a force f(t)f(t):

mx¨+cx˙+kx=f(t)m\ddot{x} + c\dot{x} + kx = f(t)

The complete solution is the sum of the homogeneous solution (studied in Chapter 1) and a particular solution. It is common to ignore the transient (homogeneous) part and focus on the steady-state response. Taking the Laplace transform with zero initial conditions gives the transfer function

H(s)=X(s)F(s)=1ms2+cs+kH(s) = \frac{X(s)}{F(s)} = \frac{1}{ms^2+cs+k}

Substituting s=jωs=j\omega gives the frequency response. Introducing the frequency ratio r=ω/ωnr=\omega/\omega_n, and dividing through by kk:

X(jω)F(jω)=1/k(1−r2)+2jζr\frac{X(j\omega)}{F(j\omega)} = \frac{1/k}{(1-r^2) + 2j\zeta r}

Exercise “Ex1” — amplitude and phase vs. frequency ratio

Plot the (normalized) amplitude ∣kX/F∣|kX/F| and the phase angle of the SDOF FRF for ζ=0.1,0.2,…,1.0\zeta = 0.1, 0.2, \dots, 1.0, on log-log / semi-log axes.

r = np.logspace(-1, 1, 400)  # omega / omega_n, from 0.1 to 10
zetas = np.arange(0.1, 1.01, 0.1)

fig, axes = plt.subplots(2, 1, figsize=(7, 8), sharex=True)
for zeta in zetas:
    H = (1.0) / ((1 - r**2) + 2j * zeta * r)  # k * X/F
    mag = np.abs(H)
    phase_deg = np.angle(H, deg=True)
    axes[0].loglog(r, mag, "k-", alpha=0.3 + 0.7 * zeta / zetas.max())
    axes[1].semilogx(r, phase_deg, "k-", alpha=0.3 + 0.7 * zeta / zetas.max())

axes[0].set_ylabel(r"$|kX/F|$")
axes[0].set_title(r"SDOF frequency-response magnitude, $\zeta=0.1 \ldots 1.0$")
axes[1].set_ylabel("Phase [deg]")
axes[1].set_xlabel(r"Frequency ratio $r=\omega/\omega_n$")
axes[1].set_title(r"SDOF frequency-response phase, $\zeta=0.1 \ldots 1.0$")
plt.tight_layout()
plt.show()
<Figure size 700x800 with 2 Axes>

As ζ→0\zeta\to0, the magnitude peak at r=1r=1 grows without bound (resonance), and the phase jumps sharply from 0°0° to −180°-180° through −90°-90° at resonance. Larger ζ\zeta flattens the peak and smooths the phase transition — this single family of curves is arguably the most important picture in this course.

Exercise “Ex2a” — the same FRF with python-control

Every linear time-invariant (LTI) system, such as the one above, can be specified by a transfer function object. In MATLAB this was sys = tf(num, den); in Python we use control.tf.

m, k = 1.0, 1.0
zeta = 0.1
c = 2 * zeta * np.sqrt(k * m)

den = [m, c, k]
num = [1]
sys = control.tf(num, den)
print(sys)

control.bode_plot(sys, dB=False, deg=True)
plt.suptitle(rf"Bode plot at fixed $\zeta$={zeta}")
plt.show()
<TransferFunction>: sys[0]
Inputs (1): ['u[0]']
Outputs (1): ['y[0]']

         1
  ---------------
  s^2 + 0.2 s + 1
<Figure size 700x420 with 2 Axes>

2.2 Sinusoidal forcing and resonance (the undamped case)

Consider F(t)=F0cos⁡ωtF(t) = F_0\cos\omega t with c=0c=0: x¨+ωn2x=f0cos⁡ωt\ddot{x}+\omega_n^2 x = f_0\cos\omega t, f0=F0/mf_0=F_0/m. Trying a particular solution xp=Xcos⁡ωtx_p = X\cos\omega t gives

X=f0ωn2−ω2(ω≠ωn)X = \frac{f_0}{\omega_n^2-\omega^2} \qquad (\omega \ne \omega_n)

Adding the homogeneous solution and applying x(0)=x0x(0)=x_0, x˙(0)=v0\dot x(0)=v_0:

x(t)=v0ωnsin⁡ωnt+(x0−f0ωn2−ω2)cos⁡ωnt+f0ωn2−ω2cos⁡ωtx(t) = \frac{v_0}{\omega_n}\sin\omega_n t + \left(x_0-\frac{f_0}{\omega_n^2-\omega^2}\right)\cos\omega_n t + \frac{f_0}{\omega_n^2-\omega^2}\cos\omega t

What happens at ω=ωn\omega=\omega_n? The particular-solution ansatz above blows up (division by zero), signalling that resonance changes the form of the particular solution to xp(t)=f02ω tsin⁡(ωt)x_p(t) = \dfrac{f_0}{2\omega}\,t\sin(\omega t) — an amplitude that grows without bound. This is the single most important physical phenomenon in this course.

def undamped_forced_response(t, wn, w, f0, x0, v0):
    if np.isclose(w, wn):
        A1, A2 = v0 / w, x0
        return A1 * np.sin(w * t) + A2 * np.cos(w * t) + (f0 / (2 * w)) * t * np.sin(w * t)
    A2 = x0 - f0 / (wn**2 - w**2)
    A1 = v0 / wn
    return A1 * np.sin(wn * t) + A2 * np.cos(wn * t) + f0 / (wn**2 - w**2) * np.cos(w * t)


wn = 1.0
t = np.linspace(0, 60, 3000)

fig, ax = plt.subplots()
for w, label in [(0.7, r"$\omega=0.7\,\omega_n$ (off resonance)"),
                  (1.0, r"$\omega=\omega_n$ (resonance)")]:
    x = undamped_forced_response(t, wn, w, f0=1.0, x0=0.0, v0=0.0)
    ax.plot(t, x, label=label)

ax.set_xlabel("Time [s]")
ax.set_ylabel("x(t)")
ax.set_title("Undamped forced response: resonance grows without bound")
ax.legend()
plt.show()
<Figure size 700x420 with 1 Axes>

Let’s cross-check the resonant case against a direct numerical integration:

def sdof_forced_ode(t, y, m, c, k, F0, w):
    x, v = y
    f = F0 * np.cos(w * t)
    return [v, (f - c * v - k * x) / m]


sol = solve_ivp(sdof_forced_ode, [0, 60], [0, 0], args=(1.0, 0.0, 1.0, 1.0, 1.0),
                 t_eval=t, rtol=1e-10, atol=1e-12)

x_analytic = undamped_forced_response(t, wn=1.0, w=1.0, f0=1.0, x0=0.0, v0=0.0)
print("Max abs difference (resonant case):", np.max(np.abs(sol.y[0] - x_analytic)))
Max abs difference (resonant case): 1.002926452997599e-08

2.3 On the use of the Laplace transform

The Laplace transform turns derivatives into algebra: L{f˙}=sF(s)−f(0)\mathcal{L}\{\dot f\}=sF(s)-f(0), L{f¨}=s2F(s)−sf(0)−f′(0)\mathcal{L}\{\ddot f\}=s^2F(s)-sf(0)-f'(0).

Exercise “H2” — Laplace transform table (handwritten, verified symbolically)

🟥 Fill in the table by hand, then check every entry with sympy.

t_s, s_s, a_s, b_s, n_s = sp.symbols("t s a b n", positive=True)

entries = {
    "a": sp.Integer(1) * a_s,
    "A*sin(b*t)": sp.sin(b_s * t_s),
    "A*cos(b*t)": sp.cos(b_s * t_s),
    "t**n": t_s**n_s,
    "A*exp(-a*t)": sp.exp(-a_s * t_s),
}

print(f"{'f(t)':<16}{'F(s)':<30}")
for name, f in entries.items():
    F = sp.laplace_transform(f, t_s, s_s, noconds=True)
    print(f"{name:<16}{sp.simplify(F)}")
f(t)            F(s)                          
a               a/s
A*sin(b*t)      b/(b**2 + s**2)
A*cos(b*t)      s/(b**2 + s**2)
t**n            s**(-n - 1)*gamma(n + 1)
A*exp(-a*t)     1/(a + s)
f(t)f(t)F(s)F(s)
aaa/sa/s
Asin⁡(bt)A\sin(bt)Ab/(s2+b2)Ab/(s^2+b^2)
Acos⁡(bt)A\cos(bt)As/(s2+b2)As/(s^2+b^2)
tnt^nn!/sn+1n!/s^{n+1}
Ae−atAe^{-at}A/(s+a)A/(s+a)

Exercise “laplaceEx1” — recovering the particular solution

Take the Laplace transform of mx¨+kx=F0cos⁡ωtm\ddot x+kx = F_0\cos\omega t (zero ICs):

X(s)=F0 s(ms2+k)(s2+ω2)X(s) = \frac{F_0\,s}{(ms^2+k)(s^2+\omega^2)}

Inverting it should recover xp(t)=f0ωn2−ω2cos⁡ωtx_p(t) = \dfrac{f_0}{\omega_n^2-\omega^2}\cos\omega t.

m_s, k_s, F0_s, w_s = sp.symbols("m k F0 omega", positive=True)
X_s = F0_s * s_s / ((m_s * s_s**2 + k_s) * (s_s**2 + w_s**2))
x_t = sp.inverse_laplace_transform(X_s, s_s, t_s)
sp.simplify(x_t)
Loading...

sympy returns the full transient + steady-state solution (including the free-vibration terms excited by suddenly switching on the force at t=0t=0); its steady-state cosine term matches xp(t)x_p(t) above once mωn2=km\omega_n^2=k is substituted.

2.4 “Doing physics with MATLAB” — four canonical numerical cases

🟩 Reproduce, numerically, four textbook cases (now via solve_ivp rather than a symbolic Laplace inversion — much more robust for damped/forced systems).

cases = [
    dict(name="(1) Free SHM, no damping, no force",
         m=1, c=0, k=4, F0=0, w=0, x0=1, v0=0, tmax=20),
    dict(name="(2) Driven AT natural frequency, no damping (resonance)",
         m=1, c=0, k=4, F0=1, w=2, x0=0, v0=0, tmax=40),
    dict(name="(3) Driven AT natural frequency, WITH damping",
         m=1, c=0.5, k=4, F0=1, w=2, x0=0, v0=0, tmax=40),
    dict(name="(4) Driven far from natural frequency, WITH damping",
         m=1, c=0.5, k=4, F0=1, w=3, x0=0, v0=0, tmax=40),
]

fig, axes = plt.subplots(len(cases), 1, figsize=(7, 12), sharex=False)
for ax, case in zip(axes, cases):
    t_eval = np.linspace(0, case["tmax"], 4000)
    sol = solve_ivp(sdof_forced_ode, [0, case["tmax"]], [case["x0"], case["v0"]],
                     args=(case["m"], case["c"], case["k"], case["F0"], case["w"]),
                     t_eval=t_eval, rtol=1e-9, atol=1e-11)
    ax.plot(t_eval, sol.y[0])
    ax.set_title(case["name"], fontsize=10)
    ax.set_ylabel("x(t)")
plt.tight_layout()
plt.show()
<Figure size 700x1200 with 4 Axes>

Comments:

  1. Pure SHM: constant-amplitude cosine at ωn=2\omega_n=2 rad/s — no dissipation, no input.

  2. Undamped resonance: linearly growing envelope ∝t\propto t — physically unrealistic forever, but this is exactly the mechanism that destroys lightly-damped structures excited near ωn\omega_n.

  3. Damped resonance: the envelope grows only until it saturates at the steady-state resonant amplitude ∝1/(2ζ)\propto 1/(2\zeta) — damping is what saves real structures.

  4. Off-resonance with damping: the transient dies out and the system settles into a modest-amplitude steady-state oscillation at the forcing frequency ω=3\omega=3.