Convolution and the impulse response
لم يُترجم بعد؛ يُعرض باللغة الإنجليزية
عن هذا الدرس
A linear, time-invariant system is completely described by one signal: its impulse response h(t), the output for a single sharp kick in. Follow an RC filter (RC = 1 ms) fed a 1 V pulse 2 ms long. Chop the pulse into thin kicks, add up one shifted, scaled copy of h for each, and let the slices get thinner: the sum becomes the convolution integral y(t) = ∫ x(τ)·h(t − τ) dτ. Then evaluate it the graphical way (flip h, slide it, multiply, take the area) and do it in Python with numpy. It builds on "System properties: linear, time-invariant, causal and stable", the Circuits lessons "The RC circuit: natural and step response" and "Step, impulse and ramp functions", and the Maths lesson "Integrals as areas".
A system turns x(t) into y(t)
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?
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"
اقرأ الدرس خطوة بخطوة
A system turns x(t) into y(t)
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?
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"The impulse: one sharp kick
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.
δ(t): a pulse of width ε and height 1/ε area = ε × 1/ε = 1, for every ε let ε -> 0 drawn as an arrow of height 1 (its area) sifting: ∫ x(τ)·δ(t − τ) dτ = x(t) more in Circuits, "Step, impulse and ramp functions"The impulse response h(t)
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.
h(t) = (1/RC)·e^(−t/RC) for t ≥ 0 = 0 for t < 0 RC = 1 ms, so h(0) = 1/RC = 1 per ms h(1 ms) = 0.368 per ms h(3 ms) = 0.050 per ms a kick of area 1 V·ms gives an output of h(t) volts: the meter shows it h is 0 before the kick: the filter is causalChop the input into slices
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.
Δτ = 0.25 ms, slices start at τ = 0, 0.25, 0.5 ... 1.75 ms (8 slices) slice at τ ≈ a kick of area x(τ)·Δτ = 1 V × 0.25 ms = 0.25 V·ms x(t) ≈ Σ x(τ)·Δτ·δ(t − τ)Each slice makes its own h
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 − τ).
slice at τ -> x(τ)·Δτ·h(t − τ) τ = 0 -> 0.25·h(t) τ = 0.25 -> 0.25·h(t − 0.25) ... τ = 1.75 -> 0.25·h(t − 1.75) shift: time-invariance scale: linearity (scaling) each copy jumps to 0.25 V, then decaysAdd the copies
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.
y(t) ≈ Σ x(τ)·h(t − τ)·Δτ (superposition) at t = 2 ms with Δτ = 0.25 ms: 0.25 × (e^−2 + e^−1.75 + ... + e^−0.25) = 0.761 V exact y(2 ms) = 1 − e^−2 = 0.865 V the sum is a staircase of jumps: just after a jump it is above y(t) (t = 1.75 ms: 0.977 V, exact 0.826 V) just before the next, below it (t = 2 ms: 0.761 V) thinner slices make the swings smallerThinner slices: the convolution integral
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.
Δτ -> 0: Σ ... Δτ -> ∫ ... dτ y(t) = ∫ x(τ)·h(t − τ) dτ = (x ∗ h)(t) y(2 ms) with slices of 0.25 ms : 0.761 V 0.05 ms : 0.843 V 0.01 ms : 0.860 V exact : 0.865 V each jump is x·Δτ·h(0) = Δτ × 1 V/ms high, so the sum never strays more than that from y(t): 0.25 V, 0.05 V, 0.01 V an integral as an area: Maths, "Integrals as areas"Flip h and slide it to t
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.
h(t − τ) as a function of τ: flipped: the jump is on the right shifted: the jump sits at τ = t τ < t : the past, weighted by h newest input counts most, old input fades as e^−(t − τ) τ > t : the future, weight 0 (causal) here t = 1 msMultiply, then take the area
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.
y(1) = ∫ x(τ)·h(1 − τ) dτ = ∫ from 0 to 1 of e^−(1 − τ) dτ = 1 − e^−1 = 0.632 V outside 0 ≤ τ ≤ 1 one curve is 0, so the product is 0 thereSlide t: the output appears
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).
0 ≤ t < 2: y = 1 − e^−t (rising) t ≥ 2: y = (1 − e^−2)·e^−(t − 2) (falling) y(1 ms) = 0.632 V y(2 ms) = 0.865 V (the peak) y(4 ms) = 0.117 V the same curves the RC lesson found by charging and discharging the capacitorConvolution in Python
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.
import numpy as np t = np.arange(800) * 0.01 x = np.where(t < 2, 1.0, 0.0) h = np.exp(-t) y = np.convolve(x, h) * 0.01 >>> print(round(y[100], 3)) # t = 1 ms 0.639 >>> print(round(y[200], 3)) # t = 2 ms 0.86 >>> len(y) 1599 (Python 3 with numpy; t in ms, RC = 1 ms)
أسئلة سريعة: 5
اختر إجابة واحدة لكل سؤال. يمكنك تغيير اختياراتك قبل التحقق منها.
01What is the impulse response h(t) of a system?
h(t) is the response to one unit kick δ(t). The response to an input that switches on and stays on is the step response, a different signal.
02Which two properties let us build the output from shifted, scaled copies of h(t)?
Time-invariance says a kick at τ gives h shifted to τ; linearity says a bigger kick gives a scaled h and that the responses to several kicks add. Together: an LTI system.
03For the RC filter with RC = 1 ms and the 1 V, 2 ms pulse, why is y(t) largest at t = 2 ms?
Before 2 ms, sliding t adds more input under the window. After 2 ms there is no new input, and the old input fades as e^−(t − τ). So the area peaks at t = 2 ms: y = 1 − e^−2 = 0.865 V. The capacitor is not full there (that would be 1 V).
04In y(t) = ∫ x(τ)·h(t − τ) dτ, what does h(t − τ) look like as a function of τ?
Replacing τ by −τ flips h; adding t slides it so the point h(0) sits at τ = t. That is why the graphical method is called flip and slide.
05x and h are numpy arrays sampled every dt seconds. Which line approximates the convolution integral?
np.convolve adds x[k]·h[n − k] over k. Each term stands for a strip dτ wide, so multiply by dt to turn the sum into an area. np.sum(x * h) * dt gives only one number, not a signal.
المسرد
- Unit impulse δ(t)
- An idealised kick: the limit of a pulse that gets thinner and taller while its area stays 1. Drawn as an arrow of height 1.
- Impulse response h(t)
- The output of a system when the input is a unit impulse. For an LTI system it describes the system completely.
- LTI system
- A system that is both linear (scaling and adding inputs scales and adds outputs) and time-invariant (delaying the input only delays the output).
- Superposition
- For a linear system, the response to a sum of inputs is the sum of the responses to each input.
- Convolution
- The operation y(t) = ∫ x(τ)·h(t − τ) dτ, written y = x ∗ h. It gives the output of an LTI system for any input.
- Flip and slide
- The graphical way to evaluate a convolution: flip h, slide it to t, multiply by x, take the area. Repeat for every t.
- Time constant RC
- For an RC circuit, the time R × C (here 1 kΩ × 1 µF = 1 ms) over which the response decays by a factor e.
الملاحظات والمصادر
- 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.
- np.convolve returns the full convolution, 1599 values for two arrays of 800. Only the first 800 line up with t; the rest describe later times, after the input array runs out. The small gap from the exact value (0.639 against 0.632 at 1 ms) shrinks as the step gets smaller.
- A. V. Oppenheim, A. S. Willsky, S. H. Nawab, Signals and Systems, 2nd ed., Pearson (ch. 2: Linear Time-Invariant Systems, the convolution integral)
- B. P. Lathi, R. A. Green, Linear Systems and Signals, 3rd ed., Oxford University Press, 2018, ch. 2 (Internet Archive record)
- MIT OpenCourseWare 6.003 Signals and Systems (D. Freeman, Fall 2011), Lecture 8: Convolution
- MIT OpenCourseWare RES.6-007 Signals and Systems (A. V. Oppenheim), Lecture 4: Convolution
- NumPy documentation: numpy.convolve (full mode, length N + M − 1)
- Convolution (Wikipedia): definition, flip and slide, LTI systems
- Impulse response (Wikipedia): an LTI system is determined by its impulse response
- Dirac delta function (Wikipedia): limit of unit-area pulses, sifting property
- RC circuit (Wikipedia): impulse response (1/RC)·e^(−t/RC)·u(t), time constant RC
اختبار يتاح بعد الخطوة الأخيرة.