A pulse in noise
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².
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.
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.
Filter, then sample
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?
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.
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.
Why it is the best
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.
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.
Decide, and code
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 %.
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.
The working
# step 1/10 · pulse
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)
The pulse p = 2, 2, 2, 2, 1, 1, 1, 1 mV and the noise RMS σ = 1 mV are chosen example values. The noise on the plots is one draw from a seeded random generator; the SNR values are exact averages over all draws, and every number in the figure is computed from this model. In continuous time the same result reads SNR_max = 2E/N0, where N0/2 is the two-sided power spectral density of the white noise and E the pulse energy. The discrete σ² plays the part of N0/2.