So far the loads have been tidy: a free-vibration nudge in Chapter 2, a single sine in Chapter 4. Real loads are rarely so polite: a gust of wind, a blast, a footstep on a floor, or a force measured on a shake table arrives as an arbitrary, wiggly time history with no formula attached.
We already own the tool that handles them. The state-space solver
sd.sdof_response from Chapter 3 does not care what
looks like; hand it any array and it returns the response. This chapter is
about the idea behind why that works, and about the classical machinery that
expresses it, the impulse-response function and Duhamel’s integral. In
one sentence: any load is a train of impulses, and the response is the sum of
their ringings. Rather than derive that with algebra, we build it with
np.convolve and watch it land on top of the engine’s answer. Along the way we
meet the standard textbook pulses (step, ramp, rectangular, half-sine), learn to
read a shock spectrum, and finish by pushing a synthesized measured force
through the structure.
1The unit impulse and the impulse-response function¶
Start with the most elementary load imaginable: a single, infinitely sharp kick. Idealize it as a force that acts for a vanishing instant but delivers a finite impulse . A unit impulse has (units of ).
Figure 1 shows the whole story of this section in one picture. The kick is a pulse of height and width , so its area stays at one as it shrinks to an instant. It leaves the mass where it was but sets it moving with velocity , and from then on the oscillator rings freely: the response starts with slope and decays inside the familiar envelope. That ring, the response to a unit kick, is the impulse-response function derived below.
Figure 1:A unit impulse as the limit of a pulse of area one (left), the state it leaves behind (middle), and the free vibration that follows, the impulse response (right).
What does a kick do to a mass at rest? Integrate the equation of motion over the vanishing instant the impulse acts. The spring and damping terms are finite, so their integrals vanish with the duration; only the impulsive force survives, and must balance . The kick therefore changes the momentum but not yet the position: just after a unit impulse the velocity jumps to while is still zero. From that instant no force acts, so the system simply vibrates freely, and we already solved that problem.
The damped free-vibration response of an underdamped SDOF released from displacement and velocity was derived back in Chapter 2:
The impulse-response function is nothing but this free vibration, with the initial conditions the kick imposes: and . Substituting them, the cosine term drops out (its coefficient is zero), and the sine coefficient collapses to , leaving
So is not a new formula at all: it is the damped free decay of Chapter 2, the signature ring of the oscillator, scaled by so that a unit kick produces it. (For the special undamped case this reduces to .) In the book’s units is in meters per , so that multiplying it by an impulse in gives a displacement in meters.
Let us get two ways and check they agree: from the formula above, and numerically, by handing the engine a tall, narrow pulse of unit area, a discrete stand-in for the kick.
# A frame: SI units (t, kN, m, s).
m, k, zeta = 2.0, 50.0, 0.05
c = 2 * zeta * np.sqrt(k * m)
p = sd.natural(m, c, k)
wn, wd, Tn = p["wn"], p["wd"], p["Tn"]
print(f"Tn = {Tn:.3f} s, wn = {wn:.3f} rad/s, wd = {wd:.3f} rad/s")
dt = 0.005
t = np.arange(0, 6.0, dt)
# (a) analytic impulse response, the formula derived above
h_exact = (1.0 / (m * wd)) * np.exp(-zeta * wn * t) * np.sin(wd * t)
# (b) numeric: a unit-area pulse in the FIRST step. Its area is
# (1/dt) * dt = 1, so it delivers a unit impulse to the engine.
p_kick = np.zeros(t.size)
p_kick[0] = 1.0 / dt
_, h_num, _, _ = sd.sdof_response(m, c, k, p_kick, dt)Tn = 1.257 s, wn = 5.000 rad/s, wd = 4.994 rad/s
fig, ax = plt.subplots(figsize=(7.4, 3.2))
ax.plot(t, h_exact * 1000, color=sd.PLT[0], label=r"analytic $h(t)$")
ax.plot(t[::8], h_num[::8] * 1000, "o", ms=4, color=sd.PLT[1],
label="numeric (unit-area pulse)")
ax.axhline(0, color="#9aa3ab", lw=1.0)
ax.set_xlabel(r"time $t$ (s)")
ax.set_ylabel(r"$h(t)$ (mm per kN$\cdot$s)")
ax.legend()
plt.show()
err = np.max(np.abs(h_num - h_exact)) / np.max(np.abs(h_exact))
print(f"max relative difference = {err*100:.2f} %")
max relative difference = 1.35 %

max relative difference = 1.35 %
Figure 2:The impulse-response function of the frame: the analytic decaying sinusoid (line) and the numerical response to a unit-area pulse (markers).
The two overlap, and the residual of 1.35 % is honest bookkeeping, not an error in the physics: the engine holds constant across each step (a zero-order hold), so a one-step pulse is almost but not exactly a mathematical impulse. We can make the agreement machine-exact by skipping the pulse entirely and injecting the impulse the way it physically acts, as the velocity jump :
# Inject the unit impulse directly as an initial velocity v0 = I/m.
_, h_v0, _, _ = sd.sdof_response(m, c, k, np.zeros(t.size), dt, v0=1.0 / m)
err_v0 = np.max(np.abs(h_v0 - h_exact)) / np.max(np.abs(h_exact))
print(f"impulse-as-velocity vs analytic: max relative difference = {err_v0:.1e}")impulse-as-velocity vs analytic: max relative difference = 2.6e-15
That is exact to roundoff, and both views are useful: kick = unit-area pulse is the picture we build the convolution from next, and kick = velocity jump is why has the free-vibration shape.
2Duhamel’s integral: any load is a train of impulses¶
Now take the leap from one kick to any load. Chop an arbitrary load into a sequence of thin vertical strips. The strip at time , of width , delivers a tiny impulse . As Figure 3 shows, that little impulse launches its own decaying ring, a copy of , scaled by the strip’s area and shifted to start at :
Because the system is linear, the total response is just the sum of all those rings. Adding them up over every strip from 0 to turns the sum into an integral, Duhamel’s integral:
Figure 3:Duhamel’s idea: a load read as a train of impulses (top), one strip of which, , launches the decaying response (bottom).
▶ Interactive: Duhamel’s integral, one impulse at a time
The arbitrary load used just below acts on this chapter’s frame, cut into strips of width . As the clock runs, each strip lights up and delivers its impulse at its start : the mass takes a kick, and a ring starts in the second panel (the newest in pink, earlier ones in gray). The bottom panel adds the rings up as they arrive and shows the engine’s response to the same load in blue; the mass moves with the sum, and the dashed outline marks where the engine puts it. The slider sets the number of strips, from 12 ( s) to 2400 ( s), and the note reports the largest gap between the sum and the engine over the 12 s.
With the default 48 strips ( s ) the sum
already follows the engine, though every kick leaves a small kink, and its
largest gap is 10.6 % of the 300.1 mm peak. With 96 strips the gap falls to
2.42 %, and with 240 to 0.85 %. At 2400 strips each strip is one 0.005 s sample,
the sum is exactly the np.convolve computed below, and the gap settles at the
0.84 % reported there. Coarse strips fail outright: with 12 strips,
s , the sum misses by 275 %, because a train of
kicks that far apart drives a different motion. A strip has to be short compared
with the period at which the structure rings.
That integral is exactly a convolution of the load with the structure’s ring, written , and a convolution is one NumPy call. To see the discrete form, sample everything on the uniform grid , , and replace the strip width by . Then (4) becomes the sum
with whenever because a ring cannot start before its impulse.
That sum is precisely what np.convolve(p, h) computes, so
the discrete Duhamel response is np.convolve(p, h) * dt, truncated back to the
original length:
# An arbitrary load with no closed form -- just an array.
tt = np.arange(0, 12.0, dt)
N = tt.size
p_arb = 8.0 * (np.exp(-0.4 * tt) * np.sin(3.0 * tt) + 0.5 * np.sin(1.3 * tt)) # kN
# impulse response sampled on the SAME grid
h = (1.0 / (m * wd)) * np.exp(-zeta * wn * tt) * np.sin(wd * tt)
# Duhamel's integral AS A NUMERICAL CONVOLUTION
u_duhamel = np.convolve(p_arb, h)[:N] * dt
# the engine's answer, for comparison
_, u_engine, _, _ = sd.sdof_response(m, c, k, p_arb, dt)fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(7.4, 4.6), sharex=True)
ax1.plot(tt, p_arb, color=sd.PLT[2])
ax1.axhline(0, color="#9aa3ab", lw=1.0)
ax1.set_ylabel(r"load $p(t)$ (kN)")
ax2.plot(tt, u_engine * 1000, color=sd.PLT[0], label="engine sd.sdof_response")
ax2.plot(tt[::10], u_duhamel[::10] * 1000, "o", ms=4, color=sd.PLT[1],
label=r"Duhamel $p * h\,\Delta t$")
ax2.axhline(0, color="#9aa3ab", lw=1.0)
ax2.set_xlabel(r"time $t$ (s)")
ax2.set_ylabel(r"response $u$ (mm)")
ax2.legend()
plt.show()
err = np.max(np.abs(u_duhamel - u_engine)) / np.max(np.abs(u_engine))
print(f"Duhamel vs engine: max relative difference = {err*100:.2f} %")
Duhamel vs engine: max relative difference = 0.84 %

Duhamel vs engine: max relative difference = 0.84 %
Figure 4:Duhamel’s integral computed as a single np.convolve (markers) and the state-space engine (line) for an arbitrary load.
The two curves are indistinguishable at plotting scale. The largest gap is 0.84 % of the peak, a discretization difference of the same kind as before (the sum samples once per step, while the engine integrates each step exactly), not a difference in the physics. This is worth pausing on: we never solved a differential equation here. We convolved the load with the structure’s ring and got the full dynamic response. Duhamel’s integral and the time-stepping engine are the same statement of linear superposition, written two ways, and the engine is what we actually reach for, because it also handles initial conditions and (in Chapter 7) nonlinearity, where convolution breaks down.
3Standard pulses from rest¶
With the general picture in hand, look at the loads that earn their own pages in every textbook because they model real events. A step is a load switched on and left on, such as a suddenly applied weight, and a ramp builds the same load up linearly. A rectangular pulse switches on and then off, like an idealized blast, and a half-sine pulse does the same more smoothly, like an impact. What matters for each is the ratio of the pulse duration (or the rise time of the ramp) to the structure’s natural period .
We build the four loads as arrays and push each through the engine. To isolate the dynamics, normalize the response by the static deflection , what the structure would settle to if were applied slowly. The ratio is called the dynamic amplification of the load.
# A clean undamped oscillator, Tn = 1 s, unit-mass scaling.
Tn0 = 1.0
wn0 = 2 * np.pi / Tn0
m0, k0 = 1.0, 1.0 * wn0**2
c0 = 0.0 # undamped, to see the pulses' bare response
p0 = 1.0 # peak load (kN)
u_st = p0 / k0 # static deflection
def make_pulse(kind, td, t):
"""Return p(t) for a standard pulse of duration td and peak p0. The engine holds
each sample for one step, so the load is on for the samples with t < td."""
p = np.zeros_like(t)
on = t < td - 1e-9
if kind == "step":
p[:] = p0
elif kind == "rectangular":
p[on] = p0
elif kind == "ramp":
p = np.where(t < td, p0 * t / td, p0)
elif kind == "half-sine":
p[on] = p0 * np.sin(np.pi * t[on] / td)
return p
dt0 = 0.002
t0 = np.arange(0, 6.0, dt0)
td = 0.6 # pulse duration -> td/Tn = 0.6fig, axes = plt.subplots(2, 2, figsize=(8.4, 5.4), sharex=True)
kinds = ["step", "ramp", "rectangular", "half-sine"]
names = {"step": "step", "ramp": r"ramp, rise time $t_d$",
"rectangular": r"rectangular, duration $t_d$", "half-sine": r"half-sine, duration $t_d$"}
for ax, kind in zip(axes.ravel(), kinds):
pp = make_pulse(kind, td, t0)
_, uu, _, _ = sd.sdof_response(m0, c0, k0, pp, dt0)
ax.plot(t0, uu / u_st, color=sd.PLT[0])
ax.plot(t0, pp / p0, color=sd.PLT[1], lw=1.4, ls="--") # load shape (scaled)
ax.axhline(1, color="#9aa3ab", lw=1.0, ls=":")
pk = np.max(np.abs(uu)) / u_st
ax.set_title(f"{names[kind]}: peak {pk:.2f}", fontsize=11.5)
for ax in axes[1]:
ax.set_xlabel(r"time $t$ (s)")
for ax in axes[:, 0]:
ax.set_ylabel(r"$u / u_\mathrm{st}$")
handles = [plt.Line2D([], [], color=sd.PLT[0], label=r"response $u/u_\mathrm{st}$"),
plt.Line2D([], [], color=sd.PLT[1], ls="--", lw=1.4, label=r"load $p/p_0$")]
fig.legend(handles=handles, loc="lower center", ncol=2, bbox_to_anchor=(0.5, 1.0))
fig.tight_layout()
plt.show()

Figure 5:Response of an undamped SDOF ( s) to four standard pulses with , normalized by the static deflection .
Two famous facts fall straight out of Figure 5. The suddenly applied step overshoots to twice the static deflection before settling. That is the origin of the rule that a load applied suddenly, released at contact rather than lowered gently, stresses a structure twice as much as the same load applied slowly; dropping it from a height adds kinetic energy and does worse still. The ramp overshoots less, the more slowly it builds, and a structure loaded gently enough shows no dynamic amplification at all. The step and the ramp keep ringing about , while the two finite pulses inject energy and then leave the system ringing freely about zero.
4The shock (response) spectrum¶
The peak response of a pulse depends on one number: . A blast that is brief compared with the structure’s period feels different from one that lasts several periods. Sweep and record the peak amplification for each, and you get a shock spectrum (also called a response spectrum for pulses), a single design curve that tells you the worst case for any pulse duration.
Before looping the engine, Example 1 computes one point of the spectrum by hand, and shows why the free vibration after the pulse matters as much as the forced phase.
The next cell runs this pulse through the engine. After it, we build the full spectrum by looping the engine over the ratio, running each case long enough to capture both the forced phase and the free vibration that follows.
# One point of the rectangular shock spectrum by hand (ex-ch05-rect-pulse): td/Tn = 0.25.
tq = np.arange(0, 3.0, dt0)
_, uq, _, _ = sd.sdof_response(m0, c0, k0, make_pulse("rectangular", 0.25 * Tn0, tq), dt0)
jq = int(np.argmax(np.abs(uq)))
print(f"peak u/u_st = {np.abs(uq[jq]) / u_st:.3f} at t = {tq[jq]:.3f} s on the 2 ms grid"
f" (hand: {2 * np.sin(np.pi * 0.25):.3f} at 0.375 s)")peak u/u_st = 1.414 at t = 0.374 s on the 2 ms grid (hand: 1.414 at 0.375 s)
ratios = np.linspace(0.05, 4.0, 90) # td / Tn
def shock_spectrum(kind):
peak = np.empty_like(ratios)
for j, r in enumerate(ratios):
td_j = r * Tn0
tend = td_j + 4.0 * Tn0 # pulse + free-vibration tail
tg = np.arange(0, tend, dt0)
pp = make_pulse(kind, td_j, tg)
_, uu, _, _ = sd.sdof_response(m0, c0, k0, pp, dt0)
peak[j] = np.max(np.abs(uu)) / u_st
return peak
S_halfsine = shock_spectrum("half-sine")
S_rect = shock_spectrum("rectangular")
print(f"half-sine peak amplification : {S_halfsine.max():.2f} "
f"at td/Tn = {ratios[np.argmax(S_halfsine)]:.2f}")
print(f"rectangular reaches its max : {S_rect.max():.2f} "
f"(for td/Tn >= 0.5)")half-sine peak amplification : 1.77 at td/Tn = 0.80
rectangular reaches its max : 2.00 (for td/Tn >= 0.5)
fig, ax = plt.subplots(figsize=(7.4, 3.6))
ax.plot(ratios, S_rect, color=sd.PLT[0], label="rectangular pulse")
ax.plot(ratios, S_halfsine, color=sd.PLT[1], label="half-sine pulse")
ax.axhline(2.0, color="#9aa3ab", lw=1.0, ls=":")
ax.text(3.9, 2.04, r"$2.0$", ha="right", va="bottom", color="#6b7280")
ax.set_xlabel(r"pulse-duration ratio $t_d / T_n$")
ax.set_ylabel(r"peak amplification $|u|_\mathrm{max}/u_\mathrm{st}$")
ax.set_ylim(0, 2.3)
ax.legend()
plt.show()

Figure 6:Shock spectra for an undamped SDOF: peak dynamic amplification versus pulse-duration ratio , for a rectangular pulse and a half-sine pulse.
Read Figure 6 as a design chart for pulse loads. On the left, where the pulse is brief (), the structure barely moves during the pulse: there is no time to build a response, and only the impulse (the area under the pulse) matters. On the right, where the pulse outlasts a half-period, the rectangular case saturates at exactly 2: a long-enough on/off pulse is, as far as the rising response is concerned, a sudden step, so it doubles the static deflection just like Figure 5. The half-sine, being smoother, never quite reaches 2 and peaks near at an amplification of about 1.77. This is the same logic that, in Chapter 6, produces the earthquake response spectrum: there the “pulse” is a whole ground motion and we sweep instead.
▶ Interactive: tracing the half-sine shock spectrum
A half-sine pulse of duration strikes the undamped oscillator with s. The slider sets from 0.06 to 2, and the buttons jump to 0.25, 0.5, 0.8, and 2. At the upper left the pulse pushes the mass, and below it the plot shows the pulse (dashed, shaded while it acts) and the response with its largest swing so far ringed. On the right, the blue marker rises with that largest swing until it lands on the half-sine shock spectrum, drawn with the rectangular spectrum in gray. The note reports the peak and whether it came while the pulse was still acting or after it had ended.
Short pulses peak after the load has gone, in the free vibration, and their peak grows with the impulse they deliver. Past about the peak moves inside the pulse, the spectrum tops out near 1.77 at , and very long pulses act almost statically, so their peak falls back toward the static value of 1.
5Response to a synthesized “measured” force¶
Finally, the case the chapter title promises: a force we did not design but recorded. To stand in for a measurement we synthesize a wind-like force (slow gusts, a burst of turbulence, an intensity envelope) sampled at a fixed , exactly as a load cell would deliver it. Then we do the only thing the engine ever asks: hand it the array.
rng = np.random.default_rng(11)
dt4 = 0.01
t4 = np.arange(0, 20.0, dt4)
# a synthesized 'measured' wind force (kN): slow gusts + turbulence + a burst
gusts = 6.0 * np.sin(2*np.pi*0.12*t4) + 3.0 * np.sin(2*np.pi*0.27*t4 + 1.0)
turb = np.cumsum(rng.standard_normal(t4.size)) * 0.18
turb -= np.linspace(turb[0], turb[-1], t4.size) # detrend the random walk
burst = 1.0 + 0.8 * np.exp(-((t4 - 8.0) / 2.5)**2) # a gust burst near t = 8 s
p_meas = (gusts + turb) * burst + 12.0 # mean wind load + fluctuations
# the structure
m4, k4, zeta4 = 3.0, 120.0, 0.03
c4 = 2 * zeta4 * np.sqrt(k4 * m4)
print(f"Tn = {sd.natural(m4, c4, k4)['Tn']:.3f} s")
t4, u4, v4, a4 = sd.sdof_response(m4, c4, k4, p_meas, dt4)
u_static = p_meas / k4 # quasi-static deflection
amp = np.max(np.abs(u4)) / np.max(np.abs(u_static))
print(f"peak force = {np.max(np.abs(p_meas)):.1f} kN, peak u = {np.max(np.abs(u4))*1000:.1f} mm")
print(f"dynamic amplification over quasi-static = {amp:.2f}")
print(f"quasi-static deflection at t = 0: {1000*u_static[0]:.0f} mm (peak u is {np.max(np.abs(u4))/u_static[0]:.2f} times it);"
f" largest: {1000*u_static.max():.0f} mm at t = {t4[np.argmax(u_static)]:.1f} s")
print(f"step overshoot factor at zeta = {zeta4}: 1 + exp(-zeta pi / sqrt(1 - zeta^2)) = "
f"{1 + np.exp(-zeta4 * np.pi / np.sqrt(1 - zeta4**2)):.2f}")Tn = 0.993 s
peak force = 24.1 kN, peak u = 252.8 mm
dynamic amplification over quasi-static = 1.26
quasi-static deflection at t = 0: 121 mm (peak u is 2.09 times it); largest: 201 mm at t = 11.0 s
step overshoot factor at zeta = 0.03: 1 + exp(-zeta pi / sqrt(1 - zeta^2)) = 1.91
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(7.6, 4.8), sharex=True)
ax1.plot(t4, p_meas, color=sd.PLT[2])
ax1.set_ylabel(r"force $p(t)$ (kN)")
ax2.plot(t4, u4 * 1000, color=sd.PLT[0], label="dynamic response (engine)")
ax2.plot(t4, u_static * 1000, color=sd.PLT[3], lw=1.4, ls="--",
label=r"quasi-static $p(t)/k$")
ax2.set_xlabel(r"time $t$ (s)")
ax2.set_ylabel(r"response $u$ (mm)")
ax2.legend(loc="lower left", bbox_to_anchor=(0.0, 1.0), ncol=2)
plt.show()

Figure 7:A synthesized “measured” wind force (top) and the response to it (bottom): the dynamic response from the engine (line) against the quasi-static deflection (dashed).
The dynamic curve is not just a scaled copy of the load. Released from rest under the steady mean wind, the structure first overshoots, and its largest swing, the 252.8 mm printed above, is this start-up transient: the suddenly applied load of the step pulse in another guise. A pure step doubles the static deflection of an undamped structure, and with the factor drops to . The peak reaches 2.09 times the quasi-static deflection at , 121 mm, slightly more than 1.91 because the wind is still rising as the structure swings. The printed amplification of 1.26 is a different ratio: the dynamic peak over the largest quasi-static deflection, 201 mm, which occurs later, at s.
After the start-up the structure settles into tracking the slow load, but with a personality of its own. Where the force jiggles faster than the structure can follow, the response smooths it out, and where the turbulence carries energy near the natural frequency, the structure rings at its own period about the slowly drifting mean. That difference between the dashed quasi-static line and the solid dynamic one is the whole reason dynamic analysis exists.
As a closing sanity check, the two independent paths we have built, Duhamel convolution and the state-space engine, must agree on this messy measured force too, and we can throw in an OpenSees run for good measure:
# Duhamel convolution on the measured force
pr4 = sd.natural(m4, c4, k4)
h4 = (1.0 / (m4 * pr4["wd"])) * np.exp(-zeta4 * pr4["wn"] * t4) * np.sin(pr4["wd"] * t4)
u4_duhamel = np.convolve(p_meas, h4)[:t4.size] * dt4
err_d = np.max(np.abs(u4_duhamel - u4)) / np.max(np.abs(u4))
print(f"Duhamel convolution vs engine : {err_d*100:.2f} %")
# OpenSeesPy cross-check (independent finite-element time history)
from osdof import opensees_sdof
_, u4_os, _, _ = opensees_sdof(m4, c4, k4, p_meas, dt4)
err_os = np.max(np.abs(u4_os - u4)) / np.max(np.abs(u4))
print(f"OpenSeesPy vs engine : {err_os*100:.2f} %")Duhamel convolution vs engine : 1.57 %
OpenSeesPy vs engine : 1.36 %
All three agree to within 1.6 %, and the small gaps come from how each method treats the force between samples, not from any disagreement about the physics. The engine holds each sample constant across its step, the OpenSees time series interpolates linearly between samples, and the convolution sums one strip per step.
6Summary¶
A unit impulse is a kick that injects momentum: it leaves but (Figure 1). The free vibration that follows is the impulse-response function , (2), obtained numerically as the response to a unit-area pulse (Figure 2).
Any load is a train of impulses, so the response is the sum of their rings, Duhamel’s integral (4), which on a uniform grid is one
np.convolve(p, h) * dtand matches the engine to within 1 % (Figure 4).The peak response to a pulse is governed by . A suddenly applied step doubles the static deflection; sweeping gives the shock spectrum (Figure 6), with the rectangular pulse saturating at an amplification of 2 and short pulses peaking after the load has gone (Example 1).
A measured force needs no formula: the engine takes the array directly (Figure 7), and Duhamel and OpenSees confirm the answer.
Chapter 6 turns the loop of the shock spectrum around: instead of sweeping the pulse duration for one structure, it sweeps the natural period for one recorded ground motion. The result is the earthquake response spectrum, the single most important design tool built from the SDOF oscillator. The engine does not change at all: the ground motion enters as the effective force of Chapter 1.