A system and its kick
This RC filter is a system: a signal x(t) goes in, a new signal y(t) comes out. Feed it a 1 V pulse 2 ms long and the output rises slowly, then falls slowly. Can we predict y(t) for any input?
Now send a single kick: the unit impulse δ(t). Picture a pulse that gets thinner and taller while its area stays 1. In the limit it lasts no time at all, yet its area is still 1.
The output for an impulse in is the impulse response, h(t). For this filter h(t) = (1/RC)·e^(−t/RC) after the kick and 0 before it: a jump to 1 per ms, then a decay with RC = 1 ms.
Any input is a row of kicks
Back to the 1 V, 2 ms pulse. Cut it into slices 0.25 ms wide. Each thin slice is almost a kick: an impulse at its start time τ, with area x(τ)·Δτ = 1 V × 0.25 ms. 8 slices rebuild the pulse.
Time-invariant: a kick at time τ gives the same h, just starting at τ. Linear: a kick of area 0.25 gives h scaled by 0.25. So every slice adds one shifted, scaled copy, 0.25·h(t − τ).
Linear also means the outputs add up. The sum of the 8 copies, Σ x(τ)·h(t − τ)·Δτ, is a staircase: it jumps above y(t) at each slice, then sags below. At 2 ms it reads 0.761 V; the exact y is 0.865 V.
Thinner slices make the swings smaller: at 2 ms, 0.843 V with 0.05 ms slices, 0.860 V with 0.01 ms. In the limit the sum becomes an integral, y(t) = ∫ x(τ)·h(t − τ) dτ: convolution, y = x ∗ h.
Flip, multiply, add up
Now read the integral as a picture, for one output time t. Draw x(τ). Flip h to get h(−τ), then slide it right by t: h(t − τ). Its jump sits at τ = t, and its tail reaches back over older input.
Multiply the two curves point by point. Where they overlap, the product x(τ)·h(t − τ) is shaded. Its area is y(t). At t = 1 ms the area is 1 − e^(−1) = 0.632 V, what the meter reads.
Slide t to the right. The overlap grows until t = 2 ms, where y = 0.865 V. Then the flipped h moves past the end of the pulse and the area shrinks: y(4 ms) = 0.117 V. Each t gives one point of y(t).
Convolution in code
numpy works on samples. With steps of 0.01 ms, np.convolve(x, h) adds x[k]·h[n − k] for every n; times 0.01 it approximates the integral. y[100] is t = 1 ms: 0.639, close to the exact 0.632.
The working
# step 1/11 · system system: x(t) in -> y(t) out R = 1 kΩ, C = 1 µF, RC = 1 kΩ × 1 µF = 1 ms input x(t) = 1 V for 0 ≤ t < 2 ms, else 0 output y(t) = the capacitor voltage this filter is linear and time-invariant (LTI) (see "System properties: linear, time-invariant, causal and stable") the RC circuit itself: Circuits, "The RC circuit: natural and step response"
R = 1 kΩ and C = 1 µF are chosen example values (RC = 1 ms); the input is a 1 V pulse 2 ms long. Every number and curve in the figure is computed from the formulas in this lesson's model, and the tests check them against a separate numerical integration. h(t) has units of 1/time (here per ms) because a kick has units of volt × time: a kick of area 1 V·ms makes an output of h(t) volts. In y = ∫ x·h dτ the units are V × (1/ms) × ms = V.