ENع
→The matched filter
الدرس 57 · Digital communications: bits on a wire

The matched filter: best SNR in white noise

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

16 دقيقة10 خطوات5 أسئلةAdvanced
عن هذا الدرس

A receiver knows the shape of the pulse it is waiting for, but white noise is added to every sample on the way. Which filter, read once, gives the biggest signal-to-noise ratio? Follow one pulse p = 2, 2, 2, 2, 1, 1, 1, 1 mV through noise of RMS 1 mV: one sample gives SNR 4, a plain sum 18, and the matched filter, the pulse flipped in time, gives E/σ² = 20. The Cauchy–Schwarz inequality shows nothing does better. It uses convolution and correlation, and the white-noise PSD from the lesson on power spectral density; it follows the lesson on the Nyquist pulse and raised cosine.

ستتعلّم

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

شكل 57 · تفاعلي
01 / 10

A known pulse is sent

To send a 1, the transmitter puts out a pulse whose shape the receiver knows in advance: p = 2, 2, 2, 2, 1, 1, 1, 1 mV, one value per sample. Its energy is the sum of squares: E = 20 mV².

pulse  p[k] = 2, 2, 2, 2, 1, 1, 1, 1  (mV)
       k = 0 .. 7, L = 8 samples

energy E = Σ p[k]²
       = 4 × 2² + 4 × 1²
       = 20 mV²

polar bits: 1 -> +p, 0 -> −p
(line coding, from earlier in this module)
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. A known pulse is sent

    To send a 1, the transmitter puts out a pulse whose shape the receiver knows in advance: p = 2, 2, 2, 2, 1, 1, 1, 1 mV, one value per sample. Its energy is the sum of squares: E = 20 mV².

    pulse  p[k] = 2, 2, 2, 2, 1, 1, 1, 1  (mV)
           k = 0 .. 7, L = 8 samples
    
    energy E = Σ p[k]²
           = 4 × 2² + 4 × 1²
           = 20 mV²
    
    polar bits: 1 -> +p, 0 -> −p
    (line coding, from earlier in this module)
  2. White noise is added

    On the way, random noise w[n] adds to every sample: r[n] = p[n − 8] + w[n]. It is white: equal power at every frequency, so samples are unrelated. Here its RMS is σ = 1 mV.

    r[n] = p[n − 8] + w[n],  n = 0 .. 31
    
    w[n]: Gaussian, mean 0, RMS σ = 1 mV
    white: flat power spectral density (PSD),
    so w[n] and w[m] are uncorrelated (n ≠ m)
    
    the plot shows one random draw
    (see "Power spectral density and white noise")
  3. One sample is a gamble

    Read one sample of the pulse, say r[8] = 2.31 mV. Its signal is 2 mV, its noise RMS 1 mV, so the signal-to-noise ratio (SNR) is 2²/1² = 4. With polar bits that is 2.3 % wrong bits.

    SNR = signal power / noise power
        = 2² / σ² = 4 / 1 = 4   (6.0 dB)
    
    this draw: r[8] = 2 + w[8] = 2.31 mV
    
    polar bits, threshold 0:
    P(error) = Q(√SNR) = Q(2) = 0.0228
             ≈ 2.3 %  (1 bit in 44)
    Q(x) = chance a standard normal exceeds x
  4. Filter first, then sample once

    Better: pass r through a filter h, then read its output y once, at time T. The pulse parts add in step, but the independent noise parts add only in power. Which h gives the biggest SNR at T?

    y[n] = Σ_k h[k]·r[n − k]   (convolution)
    
    at n = T:
    signal  = Σ_k h[k]·p[T − 8 − k]
    noise power = σ²·Σ_k h[k]²
              (independent parts: powers add)
    
    SNR(h) = (Σ h·p)² / (σ²·Σ h²)
  5. The matched filter: the pulse flipped

    The matched filter is the pulse flipped in time: h = 1, 1, 1, 1, 2, 2, 2, 2. Convolution flips h back, so its output compares r with the pulse itself, lined up so the window ends at n.

    h[k] = p[L − 1 − k]
         = 1, 1, 1, 1, 2, 2, 2, 2
    
    y[n] = Σ_k h[k]·r[n − k]
         = Σ_j p[j]·r[n − 7 + j]
    
    = slide the pulse along r, multiply, add
      (a correlation with the pulse)
  6. Slide, multiply, add

    Watch the window slide along r. At each n the filter multiplies the samples under the window by the pulse and adds them up. Where the window misses the pulse, only noise is summed, so y stays small.

    for every n:
      y[n] = Σ_j p[j]·r[n − 7 + j]
    
    window off the pulse: y = sum of noise only
    window on the pulse:  the pulse parts add up
    
    the output is drawn as the window moves
  7. The peak: full overlap at T

    At T = 15 the window covers the whole pulse, and the signal part peaks at Σ p² = E = 20. The noise there has RMS √20 = 4.47. So SNR = E²/E = E/σ² = 20, or 13.0 dB.

    T = n0 + L − 1 = 8 + 8 − 1 = 15
    
    signal part  Σ h[k]·p[7 − k] = Σ p² = 20
    noise power  σ²·Σ h² = 1 × 20 = 20
                 RMS 4.47
    SNR = 20² / 20 = E/σ² = 20  (13.0 dB)
    
    this draw: y[15] = 20 + (−0.12) = 19.88
  8. No filter beats it

    One sample gives SNR 4; a plain sum gives 18; the matched filter gives 20. The Cauchy–Schwarz inequality proves nothing beats E/σ², reached only when h has the pulse's shape. Only the energy matters.

    filter at T          SNR     dB
    one sample  h = 1      4    6.0
    plain sum   h = 1×8   18    12.6
    matched     h = p flip 20    13.0
    
    Cauchy–Schwarz: (Σ h·p)² ≤ Σh²·Σp²
    => SNR ≤ Σp²/σ² = E/σ²
    equal only when h ∝ the flipped pulse
    continuous time: SNR_max = 2E/N0
  9. Decide the bit

    The sampler reads y[15] = 19.88 and compares it with 0: positive, so the bit is 1. With polar bits, errors now happen with probability Q(√20) = Q(4.47): about 3.9 in a million, not 2.3 %.

    decision: y[T] > 0 -> 1,  y[T] < 0 -> 0
    this draw: y[15] = 19.88 -> 1
    
    P(error) = Q(√SNR)
    one sample  Q(2)    = 2.28e-2
    matched     Q(4.47) = 3.87e-6
    
    with raised-cosine pulses, a root-raised-
    cosine at each end gives zero ISI and this
    same best SNR
  10. A matched filter in Python

    In Python with numpy: p[::-1] flips the pulse, np.convolve runs the filter, and y[15] is the sample at T. The noise comes from a random generator, so each run's y[15] differs, but its average is 20.

    import numpy as np
    rng = np.random.default_rng()
    p = np.repeat([2, 1], 4)
    h = p[::-1]     # flip
    r = rng.normal(0, 1, 32)
    r[8:16] += p
    y = np.convolve(r, h)
    bit = int(y[15] > 0)
    
    >>> int(np.convolve(p, p[::-1])[7])  # no noise
    20
    
    rng.normal(0, 1, 32): mean 0, RMS 1
    (Python 3 with numpy)

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