Solved reference notebook. See 03_Duhamel_Impulse_BaseExcitation_Exercises.ipynb for the
blanked-out version.
import numpy as np
import matplotlib.pyplot as plt
import control
from scipy.integrate import solve_ivp
plt.rcParams["figure.figsize"] = (7, 4.2)
plt.rcParams["axes.grid"] = True3.1 Systems analysis and Duhamel’s principle¶
Consider a linear system (constant coefficients, initially at rest). Its Laplace transform gives with transfer function . The impulse response function is , and by the convolution theorem
For an underdamped SDOF system, the impulse response is derived from the initial-velocity response to a unit impulse ():
and the convolution (Duhamel) integral for an arbitrary force is
characterizes the system; is the input; is the output.
def impulse_response(t, m, zeta, wn):
wd = wn * np.sqrt(1 - zeta**2)
return np.exp(-zeta * wn * t) / (m * wd) * np.sin(wd * t)
m, wn, zeta = 1.0, 1.0, 0.01
t = np.linspace(0, 40, 2000)
fig, ax = plt.subplots()
ax.plot(t, impulse_response(t, m, zeta, wn))
ax.set_xlabel("Time [s]")
ax.set_ylabel("h(t)")
ax.set_title(rf"Impulse response, $\omega_n=1$, $\zeta={zeta}$")
plt.show()
3.2 Exercise “Ex2B” — simulating the response to an arbitrary input¶
Simulate the response of the LTI system from Chapter 2 (sys, with ) to a sine-wave
input over 80 s — the Python equivalent of MATLAB’s lsim(sys, f, t).
m, k = 1.0, 1.0
zeta = 0.1
c = 2 * zeta * np.sqrt(k * m)
sys = control.tf([1], [m, c, k])
t = np.linspace(0, 80, 4000)
f = np.sin(1.0 * t)
t_out, x_out = control.forced_response(sys, T=t, U=f)
fig, ax = plt.subplots()
ax.plot(t_out, x_out)
ax.set_xlabel("Time [s]")
ax.set_ylabel("x(t)")
ax.set_title("lsim-equivalent: response of the SDOF LTI system to a sine input")
plt.show()
Because the system is LTI and the input is a pure sine, the (steady-state) output is also a sine at the same frequency — only the amplitude and phase are changed, exactly as predicted by the FRF of Chapter 2 evaluated at .
Cross-check: forced_response vs. a direct numerical Duhamel convolution¶
Let’s verify that control.forced_response (which integrates the state-space realization
internally) agrees with literally evaluating the Duhamel convolution integral
numerically.
dt = t[1] - t[0]
h = impulse_response(t, m, zeta, wn=np.sqrt(k / m))
x_duhamel = np.convolve(f, h)[: len(t)] * dt
fig, ax = plt.subplots()
ax.plot(t_out, x_out, label="control.forced_response")
ax.plot(t, x_duhamel, "--", label="Duhamel convolution (numpy.convolve)")
ax.set_xlabel("Time [s]")
ax.set_ylabel("x(t)")
ax.legend()
ax.set_title("Duhamel's principle verified numerically")
plt.show()
print("Max abs difference (steady part, t>10s):",
np.max(np.abs(x_out[t > 10] - x_duhamel[t > 10])))
Max abs difference (steady part, t>10s): 0.00016998614710317383
3.3 Base excitation¶

A structure of mass is connected to a moving base through stiffness and viscous damping . This models, e.g., a car suspension excited by the road, or a building base excited by ground motion. The equation of motion is
Often, machines are harmonically excited through their elastic mounting — see e.g. satellite or building modal-analysis demonstrations on YouTube.
(a) Displacement transmissibility. Assume , . Substituting into the EoM and solving for (with ):
(b) Force transmissibility. The force transmitted to the structure is . Working through the same complex algebra,
r = np.linspace(0.01, 4, 800)
fig, axes = plt.subplots(1, 2, figsize=(11, 4.2))
for zeta in [0.05, 0.1, 0.25, 0.5, 0.7, 1.0]:
TR = np.sqrt((1 + (2 * zeta * r) ** 2) / ((1 - r**2) ** 2 + (2 * zeta * r) ** 2))
axes[0].plot(r, TR, label=rf"$\zeta={zeta}$")
axes[1].plot(r, r**2 * TR, label=rf"$\zeta={zeta}$")
for ax, title in zip(axes, ["Displacement transmissibility |X/Y|",
"Force transmissibility |F_T/(kY)|"]):
ax.axvline(np.sqrt(2), color="k", ls=":", lw=1)
ax.set_xlabel(r"Frequency ratio $r=\omega/\omega_n$")
ax.set_title(title)
ax.legend(fontsize=8)
axes[0].axhline(1, color="k", lw=0.6)
plt.tight_layout()
plt.show()
The dotted vertical line marks : for , isolation is worse than doing nothing (); beyond , higher damping actually starts to hurt isolation performance (the classic vibration-isolation design trade-off).
3.4 Vibration suppression: the Dynamic Vibration Absorber (DVA)¶
A Dynamic Vibration Absorber is a secondary mass-spring(-damper) system attached to a primary structure to reduce its dynamic response. It was first applied by Frahm (1909) to reduce ship rolling/hull vibrations; Ormondroyd & Den Hartog (1928) gave the theory, and Den Hartog’s Mechanical Vibrations (1940) remains the classic reference for optimal tuning.
The idea: tune the absorber’s natural frequency to the troublesome primary resonance . Let’s demonstrate the effect on a simple undamped 2-mass system, primary mass , (so ,rad/s), harmonically forced at the primary mass.
def two_mass_frf(w, mp, kp, ma, ka, cp=0.0, ca=0.0):
"""Complex FRF X_primary/F for a primary mass with an attached absorber."""
Zp = -mp * w**2 + 1j * cp * w + kp
Za = -ma * w**2 + 1j * ca * w + ka
# 2x2 dynamic stiffness matrix (coupling term -ka - j*ca*w)
K11, K12 = Zp + ka + 1j * ca * w, -(ka + 1j * ca * w)
K21, K22 = -(ka + 1j * ca * w), Za
det = K11 * K22 - K12 * K21
Xp = K22 / det # response to unit force on primary mass
return Xp
mp, kp = 1.0, 1.0
w = np.linspace(0.2, 2.0, 2000)
fig, ax = plt.subplots()
Xp_noabsorber = 1.0 / (-mp * w**2 + kp)
ax.semilogy(w, np.abs(Xp_noabsorber), label="No absorber")
for mass_ratio in [0.05, 0.1, 0.2]:
ma = mass_ratio * mp
ka = ma * (1.0) ** 2 # tuned: omega_a = omega_p = 1
Xp = two_mass_frf(w, mp, kp, ma, ka, cp=0.0, ca=0.02 * ka)
ax.semilogy(w, np.abs(Xp), label=rf"Tuned absorber, $m_a/m_p={mass_ratio}$")
ax.set_xlabel(r"Forcing frequency $\omega$ [rad/s]")
ax.set_ylabel(r"$|X_{\text{primary}}/F|$")
ax.set_title("Effect of a tuned dynamic vibration absorber")
ax.legend(fontsize=8)
plt.show()
A perfectly tuned absorber creates an anti-resonance (a notch) exactly at , splitting the single primary resonance into two new peaks straddling it — the essence of DVA design (with real damping, Den Hartog showed there is an optimal that minimizes the worst-case peak across both new resonances).