SS Notes
Comprehensive guide to digital filters — FIR and IIR structures, difference equations, frequency response, filter design, and implementation considerations.
Introduction
Digital filters are the workhorses of modern signal processing. Every time your phone processes audio, every time a medical instrument cleans up an ECG signal, every time a communication receiver separates your data from noise — digital filters are doing the heavy lifting. A digital filter takes a discrete-time input sequence and produces a discrete-time output sequence according to a specific mathematical rule, selectively modifying the frequency content of the signal.
For B.Tech students, understanding digital filters means bringing together difference equations, z-transforms, frequency response, and implementation — it is where the mathematical theory becomes tangible, implementable code running on real hardware.
What is a Digital Filter?
A digital filter is a discrete-time LTI system characterized by its difference equation:
$$y[n] = \sum_{k=0}^{M} b_k x[n-k] - \sum_{k=1}^{N} a_k y[n-k]$$
where $x[n]$ is the input, $y[n]$ is the output, $b_k$ are the feedforward coefficients, and $a_k$ are the feedback coefficients. Taking the z-transform:
$$H(z) = \frac{Y(z)}{X(z)} = \frac{\sum_{k=0}^{M} b_k z^{-k}}{1 + \sum_{k=1}^{N} a_k z^{-k}} = \frac{b_0 + b_1 z^{-1} + \cdots + b_M z^{-M}}{1 + a_1 z^{-1} + \cdots + a_N z^{-N}}$$
The transfer function $H(z)$ completely characterizes the filter. Its poles and zeros determine the frequency response shape.
FIR vs IIR: The Two Families
FIR (Finite Impulse Response) Filters
When all feedback coefficients are zero ($a_k = 0$), the filter is FIR:
$$y[n] = \sum_{k=0}^{M} b_k x[n-k] = b_0 x[n] + b_1 x[n-1] + \cdots + b_M x[n-M]$$
The impulse response has exactly $M+1$ nonzero samples: $h[n] = b_n$ for $0 \leq n \leq M$.
Advantages of FIR:
- Always stable (no feedback, no poles except at $z = 0$)
- Can achieve exactly linear phase (constant group delay)
- No limit cycle oscillations in fixed-point implementations
- Simple to design using windowing or Parks-McClellan algorithm
Disadvantage: Requires many more coefficients (taps) than IIR for the same frequency selectivity. A sharp low-pass filter might need 100+ FIR taps vs. 5-10 IIR coefficients.
IIR (Infinite Impulse Response) Filters
When feedback coefficients are nonzero, the filter is IIR — its impulse response extends infinitely:
$$y[n] = \sum_{k=0}^{M} b_k x[n-k] - \sum_{k=1}^{N} a_k y[n-k]$$
Advantages of IIR:
- Much more computationally efficient (fewer coefficients for sharp transitions)
- Can directly implement classical analog filter designs (Butterworth, Chebyshev, Elliptic)
Disadvantages:
- Can be unstable if poles move outside the unit circle
- Cannot achieve linear phase (introduces phase distortion)
- Susceptible to limit cycles and overflow in fixed-point arithmetic
Frequency Response
The frequency response is obtained by evaluating $H(z)$ on the unit circle ($z = e^{j\omega}$):
$$H(e^{j\omega}) = |H(e^{j\omega})| \cdot e^{j\angle H(e^{j\omega})}$$
The magnitude response $|H(e^{j\omega})|$ tells us how much each frequency is amplified or attenuated. The phase response $\angle H(e^{j\omega})$ tells us how much each frequency is delayed.
For a filter to pass frequencies in the band $[\omega_1, \omega_2]$ and reject others:
- Passband: $|H(e^{j\omega})| \approx 1$ (frequencies passed through)
- Stopband: $|H(e^{j\omega})| \approx 0$ (frequencies blocked)
- Transition band: Gradual roll-off between passband and stopband
Filter Types by Frequency Selection
Low-Pass Filter (LPF)
Passes frequencies below cutoff $\omega_c$, rejects above. Used for: anti-aliasing, smoothing, noise removal.
High-Pass Filter (HPF)
Passes frequencies above cutoff, rejects below. Used for: DC removal, edge detection, baseline wander removal.
Band-Pass Filter (BPF)
Passes frequencies between $\omega_1$ and $\omega_2$. Used for: selecting a radio channel, isolating a frequency band.
Band-Stop (Notch) Filter
Rejects frequencies in a band. Used for: removing 50/60 Hz power line interference, eliminating specific tones.
Linear Phase and Its Importance
A filter has linear phase if $\angle H(e^{j\omega}) = -\alpha\omega$ (phase is proportional to frequency). This means all frequencies are delayed by the same amount (group delay = $\alpha$ samples), preserving the waveshape.
For FIR filters, linear phase is achieved when the coefficients are symmetric or antisymmetric:
- Type I: $h[n] = h[M-n]$, odd length, symmetric — can implement any filter type
- Type II: $h[n] = h[M-n]$, even length, symmetric — cannot be highpass
- Type III: $h[n] = -h[M-n]$, odd length, antisymmetric — differentiators, Hilbert transformers
- Type IV: $h[n] = -h[M-n]$, even length, antisymmetric — differentiators, Hilbert transformers
Design Methods
FIR Design: Window Method
- Start with the ideal (unrealizable) impulse response $h_d[n]$ (e.g., sinc for low-pass)
- Truncate to finite length by multiplying with a window $w[n]$
- The choice of window controls the trade-off between main-lobe width (transition band) and sidelobe level (stopband attenuation)
Common windows: Rectangular (-13 dB), Hamming (-43 dB), Blackman (-58 dB), Kaiser (adjustable).
IIR Design: Bilinear Transform
- Design an analog prototype filter (Butterworth, Chebyshev, Elliptic)
- Apply the bilinear transformation: $s = \frac{2}{T_s} \cdot \frac{1-z^{-1}}{1+z^{-1}}$
- This maps the entire analog frequency axis to one revolution around the unit circle
Frequency warping: $\omega_{analog} = \frac{2}{T_s}\tan(\omega_{digital}/2)$. Pre-warp critical frequencies before designing the analog prototype.
Implementation Structures
Direct Form I
Implements the difference equation directly. Requires $M + N + 1$ multipliers and $M + N$ delay elements.
Direct Form II (Transposed)
Minimizes memory by sharing delay elements between feedforward and feedback paths. Requires only $\max(M, N)$ delays.
Cascade (Second-Order Sections)
Factor $H(z)$ into second-order sections (biquads): $H(z) = \prod_{k} H_k(z)$. Each biquad has at most 2 poles and 2 zeros. This is the preferred implementation for IIR filters because it minimizes coefficient sensitivity and overflow issues.
Worked Example
Design a simple 3-tap averaging filter (low-pass FIR):
$$h[n] = \{1/3, 1/3, 1/3\}$$
$$H(z) = \frac{1}{3}(1 + z^{-1} + z^{-2})$$
Frequency response: $H(e^{j\omega}) = \frac{1}{3}e^{-j\omega}(1 + 2\cos\omega)$
This has zeros at $\omega = \pm 2\pi/3$ and magnitude that decreases with frequency — a simple low-pass behavior. The phase is linear ($-\omega$ after factoring out $e^{-j\omega}$).
Key Takeaways
- Digital filters implement difference equations that selectively modify frequency content
- FIR filters are always stable and can achieve linear phase; IIR filters are more efficient but may be unstable
- The transfer function $H(z)$ and its evaluation on the unit circle give the complete frequency response
- Filter types (LP, HP, BP, BS) are characterized by their passband and stopband regions
- FIR design uses windowed ideal responses; IIR design uses bilinear transform from analog prototypes
- Cascade biquad sections are the preferred IIR implementation for numerical robustness
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Digital Filters.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Signals & Systems topic.
Search Terms
signal-systems, signals & systems, signal, systems, digital, processing, basics, filters
Related Signals & Systems Topics