C9 · Lesson 15 · Frequency response, distortion and ideal filters
Gain, phase, delay, and the filter you can't build
An audio amplifier should change only the size of a signal; a cable should only delay it. Anything else is distortion: frequencies amplified unequally, or delayed by different amounts so a sharp edge smears. The frequency response tells exactly which, through its magnitude and its phase. And it explains a surprising fact about the filter every designer would like to have, one that passes everything below a cutoff perfectly and nothing above it: its impulse response starts before the impulse arrives. The ideal filter can't be built, only approached.
- The curve is the impulse response of an ideal low-pass filter with cutoff : , a central peak with ripples on both sides.
- Raise : the peak gets taller and narrower. A wider passband gives a sharper response in time.
- Look left of t = 0: the ripples are there too. The filter responds before the impulse arrives, so no real circuit can do this. Real filters delay a truncated version of it, or settle for a gentler cutoff.
Predict
The ideal low-pass filter passes every frequency below 1 kHz with gain 1 and zero phase, and nothing above. What is wrong with building one?
Its impulse response, , stretches to t = −∞, so it isn't causal. A real filter can delay a long stretch of it and cut off the rest (which is how FIR filters approximate it), but a perfectly sharp edge with zero delay is out of reach.
Name it
Magnitude and phase
. The magnitude is the gain at each frequency (often in dB, ), the phase is the shift.
Distortionless transmission
A system that only scales and delays, , has
a flat magnitude and a linear phase, . Unequal gains cause magnitude distortion; a phase that isn't a straight line through the origin causes phase distortion: frequencies arrive at different times and edges smear.
Delay
The group delay is how late the envelope of a narrowband signal near ω arrives. For an RC low-pass, and : τ at low frequencies, half that at the corner. A symmetric FIR filter of N taps has exactly linear phase, delaying everything by (N − 1)/2 samples.
Ideal filters
The ideal low-pass, for and 0 above, has
with : height , zeros every , and nonzero for t < 0. Ideal high-pass, band-pass and band-stop filters are built from it, and none is causal.
Worked example
An RC low-pass has τ = 1 ms. What is its group delay at low frequencies and at its corner?
Show the solution
- Group delay of the RC low-pass.
- Near DC. It's τ = 1 ms.
- At the corner. There ωτ = 1, so it's τ/2 = 0.5 ms.
- What that means. Frequencies near the corner arrive earlier than low ones, which is a small amount of phase distortion.
Answer 1 ms at low frequencies and 0.5 ms at the corner.
Worked example
An 11-tap FIR filter has symmetric coefficients. What is its phase at ω = π/4?
Show the solution
- Linear phase. Symmetry makes the phase (the center tap is 5 samples in), wherever the gain is positive.
- At π/4.
- No distortion. Every frequency is delayed by exactly 5 samples: no phase distortion.
Answer the phase is −5π/4, or −225°, a delay of exactly 5 samples.
Worked example
The ideal low-pass with cutoff has . Find h[0], h[2] and h[4], and say why it can't be built.
Show the solution
- h[0]. The limit at n = 0:
- h[2] and h[4].
- Why it can't be built. The response extends forever in both directions, with samples before n = 0, so it's non-causal and infinitely long.
- In practice. Practical filters truncate and delay it, which costs a gradual transition band and ripple.
Answer h[0] = 0.25, h[2] = 0.159 and h[4] = 0. It can't be built because it's non-causal and infinitely long.
Check
A pure delay of 0.5 ms. What phase shift does it give a 100 Hz sinusoid, in degrees?
Check
What is the group delay of an RC low-pass with τ = 2 ms at 100 Hz?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
An ideal low-pass filter cuts off at 2 kHz.
(a)
What is the height of its impulse response's peak, per millisecond?
(b)
Where is its first zero after t = 0?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
A symmetric FIR filter has 21 taps. How many samples does it delay every frequency?
Check
A system's phase is with = 1 ms and a constant = 30°.
(a)
What is its group delay?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
What is its phase delay at 500 Hz?
Check
An RC low-pass uses R = 1 kΩ and C = 10 nF. What is its 3 dB bandwidth?
Write units the way you normally would: 1.5 Hz, 1500 mHz and 0.0015 kHz are the same answer.
Check
A filter passes 1 kHz with gain 1 and 3 kHz with gain 1, but delays 3 kHz by 0.2 ms more than 1 kHz. What happens to a square wave at 1 kHz?
Check
A linear-phase FIR filter has 31 symmetric taps and runs at 1 kHz.
(a)
What is its delay in samples?
(b)
And in milliseconds?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
Check
An RC low-pass has τ = 1 ms.
(a)
What is its group delay where ωτ = 0.5?
Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.
(b)
At what frequency is that?
Explain why
Why does a perfectly flat magnitude still not guarantee an undistorted output?
A signal's shape depends on how its frequency components line up in time, not just on their sizes. A flat magnitude keeps every component the right size, but if the phase isn't a straight line through the origin, different frequencies are delayed by different amounts. The components of a sharp edge or a pulse then arrive out of step and the waveform smears or rings, even though a spectrum analyzer would show the same amplitudes. Only linear phase delays every frequency equally, so the whole signal just moves later.
Practice
Keep practicing
11 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.