A symmetric filter
A packet is a short burst of one sine wave. The source sends two at once: a low one at 250 Hz and a high one at 750 Hz, sampled 8000 times a second. The question: how late does each come out of a filter?
Filter A is the 21-tap Hamming lowpass from the windowing lesson, cutoff 1000 Hz. Its taps are a mirror image around the middle one: h[n] = h[20 − n]. Fold the plot at n = 10 and the halves match.
Send both packets through A. Each comes out exactly 10 samples (1.25 ms) after it went in, low and high alike. They arrive together, so a pulse or a sound made of both keeps its shape.
Phase and group delay
Delaying a tone by D samples turns it by −ω·D radians. So A's phase is φ(ω) = −10ω: a straight line through zero. At 250 Hz that is −1.96 rad; at 750 Hz, −5.89 rad. This is linear phase.
Pair the taps: h[0] with h[20], h[1] with h[19], and so on. Each pair sits the same distance either side of n = 10, so their two turns average to the middle one. Every pair points along e^(−j10ω).
Group delay is how late a packet's envelope arrives: τ(ω) = −dφ/dω, the downhill slope of the phase. A straight line has the same slope everywhere, so A gives τ = 10 samples at every frequency.
A lopsided twin
Filter B has exactly A's gain at every frequency. It was built from A's zeros, with those outside the unit circle flipped inside (a minimum-phase filter). Its taps bunch up at the start and are not symmetric.
Through B the 250 Hz packet takes 3.87 samples and the 750 Hz packet 5.41. Both arrive sooner than with A, but not together. B's phase curve bends, so its slope, the delay, changes with frequency.
In code and in practice
scipy.signal.group_delay takes a filter as (b, a) and the frequencies in hertz when you give fs. For filter A it prints 10 samples at both 250 and 750 Hz. np.sinc(m/4)/4 is the delayed ideal lowpass.
A symmetric 21-tap filter always waits 10 samples (1.25 ms). Audio, ECG and data receivers pay that to keep shapes. Control loops often prefer a quick filter like B. Offline, filtfilt runs a filter forward then backward: zero phase.
The working
# step 1/10 · packets
packet = a short burst of a sine wave
(one frequency, a smooth on and off)
low f = 250 Hz ω = 2π·250/8000 = 0.196 rad/sample
high f = 750 Hz ω = 2π·750/8000 = 0.589 rad/sample
fs = 8000 samples per second
1 sample = 0.125 ms
Filter A is the Hamming-windowed 21-tap lowpass (cutoff 1000 Hz at 8000 samples a second) designed in the windowing lesson. Filter B is computed from A's zeros. Every number and curve in the figure is computed from these taps. A packet's envelope is delayed by the group delay at its frequency when the packet is narrow in frequency (Oppenheim and Schafer §5.1). The motion is slowed down and counted in samples.