Chapter - 5

Key Words: Overview, Compressors, Ratio, Attack, Gain

Filter Design Techniques

🎯 Learning Objectives

By the end of this topic, you should be able to:

  • Understand the principles of FIR and IIR filter design.
  • Apply windowing techniques to design FIR filters.
  • Transform analog filter designs to digital using bilinear transform.
  • Generate and visualize filter frequency responses using Python.

Introduction

Filter design is the process of determining the coefficients of a digital filter so that it meets specific performance criteria.
Two major categories exist:

  1. FIR (Finite Impulse Response) Filter Design
  2. IIR (Infinite Impulse Response) Filter Design

Each has unique design methods, advantages, and limitations.


FIR Filter Design Using Windowing

FIR filters are non-recursive and inherently stable. Their impulse response has a finite number of non-zero samples.

Ideal Filter

An ideal low-pass filter has the frequency response:

Hd(ω)={1ωωc0otherwiseH_d(\omega) = \begin{cases} 1 & |\omega| \leq \omega_c \\ 0 & \text{otherwise} \end{cases}

The corresponding impulse response is given by the inverse DTFT:

hd[n]=sin(ωc(nM/2))π(nM/2)h_d[n] = \frac{\sin(\omega_c (n-M/2))}{\pi (n-M/2)}

where ( M ) is the filter length.

Windowing

Direct truncation causes Gibbs phenomenon (ripples in the frequency response).
To reduce ripples, we multiply by a window function ( w[n] ):

h[n]=hd[n]w[n]h[n] = h_d[n] \cdot w[n]

Common windows:

  • Rectangular: Simple truncation
  • Hamming: Smooth edges, lower ripple
  • Hanning: Similar to Hamming, slightly different coefficients
  • Blackman: High attenuation in stopband
FIR windowing
Figure. Windowed FIR filter impulse response.

Python Example: FIR Window Design

Press Run Code: Output will appear here.

IIR Filter Design

IIR filters are recursive and can achieve sharper frequency responses with fewer coefficients.
However, stability must be carefully ensured.

Analog-to-Digital Transformation

We often start with an analog prototype filter and convert it to digital:

  1. Impulse Invariance: Matches the impulse response of analog filter to digital
  2. Bilinear Transform: Maps the s-plane to the z-plane, prevents aliasing
s=2T1z11+z1s = \frac{2}{T} \frac{1 - z^{-1}}{1 + z^{-1}}

Example: Butterworth Low-pass Filter

Analog prototype:

Ha(s)=11+(s/ωc)2nH_a(s) = \frac{1}{1 + (s/\omega_c)^{2n}}

where ( n ) = filter order, ( \omega_c ) = cutoff frequency.

Bilinear transform to digital, then compute coefficients ( b, a ) for:

H(z)=b0+b1z1+...1+a1z1+...H(z) = \frac{b_0 + b_1 z^{-1} + ...}{1 + a_1 z^{-1} + ...}

Python Example: IIR Filter Design

Press Run Code: Output will appear here.

🎨 Interactive Filter Design Demo

FIR Window Comparison with Phase

Time Domain

Magnitude Response (Single-Sided FFT)

Phase Response (Single-Sided FFT)


Key Takeaways:

  • FIR filters are always stable and can use windowing methods for design.
  • IIR filters are recursive, more efficient but require careful stability analysis.
  • Bilinear transform and impulse invariance convert analog filters to digital.
  • Python scipy.signal provides easy functions for designing and visualizing filters.

🧠 Quick Quiz

Test your understanding of filter design techniques:

1) Which method reduces the Gibbs phenomenon in FIR filters?

2) Which IIR design method maps the s-plane to the z-plane?

3) Which filter type is inherently stable?

4) What is a key advantage of IIR filters over FIR filters?

5) In FIR windowing, what does the window function control?