ENع
→Convolution
الدرس 06 · Signals and systems in continuous time

Convolution and the impulse response

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

15 دقيقة11 خطوة5 أسئلةBeginner
عن هذا الدرس

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".

ستتعلّم

حدّد ما تشعر بأنك أتقنته. هذا التقييم الذاتي لا يؤثر في درجة الدرس.

شكل 6 · تفاعلي
01 / 11

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"
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. 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"
  2. 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"
  3. 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 causal
  4. Chop 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 − τ)
  5. 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 decays
  6. Add 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 smaller
  7. Thinner 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"
  8. 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 ms
  9. Multiply, 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 there
  10. Slide 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 capacitor
  11. Convolution 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)

اختبار يتاح بعد الخطوة الأخيرة.