SS Notes
Complete guide to FIR filter design — windowing method, Parks-McClellan algorithm, linear phase property, implementation structures, and applications.
Introduction
FIR (Finite Impulse Response) filters are the most widely used type of digital filter in practice. Their impulse response has a finite number of nonzero samples, which gives them two extraordinary advantages: guaranteed stability (they cannot oscillate or blow up) and the ability to achieve exactly linear phase (preserving signal shape while filtering). Every time you use a noise-canceling headphone, every time your phone processes audio, every time a medical device filters a patient's ECG — chances are high that FIR filters are involved.
For B.Tech students, FIR filters represent the most accessible entry point into practical filter design. The theory is clean, the design methods are systematic, and the results are immediately implementable in code.
Structure and Difference Equation
An FIR filter of order $M$ (length $M+1$) is defined by:
$$y[n] = \sum_{k=0}^{M} h[k] \cdot x[n-k] = h[0]x[n] + h[1]x[n-1] + \cdots + h[M]x[n-M]$$
This is simply the convolution of the input with the impulse response $h[n]$. The output at each instant is a weighted average of the current and $M$ past input samples.
The transfer function (z-transform) is:
$$H(z) = \sum_{k=0}^{M} h[k] z^{-k} = h[0] + h[1]z^{-1} + h[2]z^{-2} + \cdots + h[M]z^{-M}$$
This is a polynomial in $z^{-1}$ — all zeros, no poles (except at $z = 0$). Since there are no poles that could be outside the unit circle, the filter is always stable.
Linear Phase Property
Why Linear Phase Matters
A filter has linear phase if its phase response is:
$$\angle H(e^{j\omega}) = -\frac{M}{2}\omega$$
This means every frequency component is delayed by exactly $M/2$ samples (the group delay is constant). The signal shape is preserved — only shifted in time. For applications like audio (where phase distortion is audible) and data communications (where waveshape matters for detection), linear phase is essential.
Symmetry Condition
Linear phase requires symmetric (or antisymmetric) impulse response coefficients:
Type I (symmetric, odd length): $h[n] = h[M-n]$, $M$ even
- Can implement LP, HP, BP, BS filters
- Example: $h = \{0.1, 0.3, \mathbf{0.5}, 0.3, 0.1\}$
Type II (symmetric, even length): $h[n] = h[M-n]$, $M$ odd
- Has a zero at $\omega = \pi$ → cannot be highpass
Type III (antisymmetric, odd length): $h[n] = -h[M-n]$, $h[M/2] = 0$
- Zeros at $\omega = 0$ and $\omega = \pi$ → used for Hilbert transformers, differentiators
Type IV (antisymmetric, even length): $h[n] = -h[M-n]$
- Zero at $\omega = 0$ → differentiators, Hilbert transformers
FIR Design: Window Method
The most intuitive design approach:
Step 1: Ideal Filter Response
The ideal low-pass filter with cutoff frequency $\omega_c$ has impulse response:
$$h_d[n] = \frac{\sin(\omega_c(n - M/2))}{\pi(n - M/2)} = \frac{\omega_c}{\pi}\text{sinc}\left(\frac{\omega_c(n-M/2)}{\pi}\right)$$
This is infinite in extent (IIR) and non-causal — we need to truncate it.
Step 2: Apply a Window
$$h[n] = h_d[n] \cdot w[n], \quad 0 \leq n \leq M$$
The window $w[n]$ smoothly tapers the ideal response to zero at the edges, controlling the trade-off:
| Window | Transition Width | Stopband Attenuation |
|---|---|---|
| Rectangular | $0.9\pi/M$ | -21 dB (poor) |
| Hamming | $6.6\pi/M$ | -53 dB |
| Blackman | $11\pi/M$ | -74 dB |
| Kaiser ($\beta$) | Adjustable | Adjustable |
Step 3: Design Equation for Filter Length
For a Hamming window, the required filter length for transition bandwidth $\Delta\omega$ and minimum stopband attenuation of 53 dB:
$$M \approx \frac{6.6\pi}{\Delta\omega} = \frac{6.6\pi}{(\omega_s - \omega_p)}$$
For the Kaiser window (most flexible):
$$M = \frac{A - 7.95}{2.285 \cdot \Delta\omega}$$
where $A = -20\log_{10}(\delta)$ is the desired attenuation in dB and $\delta$ is the ripple tolerance.
FIR Design: Parks-McClellan (Optimal)
The Parks-McClellan algorithm (using the Remez exchange algorithm) designs the optimal equiripple FIR filter that minimizes the maximum error (Chebyshev criterion) in specified bands.
Given specifications:
- Passband: $[0, \omega_p]$ with ripple $\delta_p$
- Stopband: $[\omega_s, \pi]$ with attenuation $\delta_s$
The algorithm finds the shortest filter that meets both specifications simultaneously. The result has equal-magnitude ripples in both passband and stopband (equiripple behavior) — this is optimal because no shorter filter can meet the same specifications.
Frequency Sampling Method
Another approach: specify the desired frequency response at $N$ equally-spaced points and take the inverse DFT:
$$h[n] = \frac{1}{N}\sum_{k=0}^{N-1} H_d[k] \cdot e^{j2\pi kn/N}$$
The resulting filter matches exactly at the $N$ specified frequencies and interpolates between them. Transition samples (values between 0 and 1 at the band edges) can reduce sidelobes.
Implementation Considerations
Direct Form
The convolution sum is implemented directly with $M+1$ multipliers and a shift register:
Efficient Structures
For symmetric coefficients ($h[k] = h[M-k]$), pair terms to reduce multiplications by nearly half:
$$y[n] = \sum_{k=0}^{M/2-1} hk + h[M/2]x[n-M/2]$$
FFT-Based Convolution (Overlap-Save/Overlap-Add)
For long FIR filters ($M > 50-100$ taps), frequency-domain convolution via FFT is more efficient:
- Compute $H[k] = \text{FFT}\{h[n]\}$ once (store)
- For each block of input: $Y[k] = H[k] \cdot X[k]$
- $y[n] = \text{IFFT}\{Y[k]\}$
The computational saving occurs because FFT is $O(N\log N)$ vs $O(NM)$ for direct convolution.
Worked Example
Design a low-pass FIR filter with $\omega_c = 0.4\pi$ using a length-7 Hamming window.
Step 1: Ideal impulse response (shifted by $M/2 = 3$): $$h_d[n] = \frac{\sin(0.4\pi(n-3))}{\pi(n-3)}, \quad n = 0, 1, \ldots, 6$$
Computing: $h_d = \{-0.0935, 0, 0.3027, 0.4, 0.3027, 0, -0.0935\}$
Step 2: Hamming window: $w[n] = 0.54 - 0.46\cos(2\pi n/6)$: $w = \{0.08, 0.31, 0.77, 1.0, 0.77, 0.31, 0.08\}$
Step 3: Final coefficients: $h[n] = h_d[n] \cdot w[n]$: $h = \{-0.0075, 0, 0.2331, 0.4, 0.2331, 0, -0.0075\}$
The symmetric coefficients confirm linear phase. The filter attenuates high frequencies while preserving signal timing.
Applications of FIR Filters
- Anti-aliasing: Pre-filtering before downsampling (decimation)
- Audio equalization: Linear-phase tone control preserving sound quality
- Pulse shaping: Raised-cosine FIR filters in digital communications
- Image processing: 2D FIR kernels for edge detection, blurring, sharpening
- Biomedical: Motion artifact removal, ECG baseline correction
- Matched filters: Correlation receivers in radar and communications
Key Takeaways
- FIR filters have finite-length impulse responses: always stable, can be exactly linear phase
- Linear phase requires symmetric/antisymmetric coefficients — preserving signal waveshape
- Window method: truncate ideal response with a smooth window (Hamming, Kaiser, Blackman)
- Parks-McClellan gives the optimal (shortest) equiripple filter meeting given specifications
- FIR filters need more taps than IIR for sharp transitions, but offer guaranteed stability and linear phase
- FFT-based convolution makes long FIR filters computationally efficient
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for FIR 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, fir
Related Signals & Systems Topics