ELEC6218 · Signal Processing Analog & Digital Filter Design
Signal Processing · Lecture notes Prof. Çelik
ELEC6218 · Signal Processing
Lecture 6

Digital Filter Design

Digital filters fall into two main families. FIR filters are always stable and can have exactly linear phase, but they often need more coefficients. IIR filters can meet the same magnitude specification with a lower order, but their phase is usually nonlinear and their stability must be checked.

Quiz
Podcast ↓ MP3
InstructorProf. Abdulkadir Çelik (https://akadircelik.com) ModuleELEC6218 TopicsFIR vs. IIR · exact linear phase · moving average · two-pole resonator · cascaded pole–zero design
▸ No feedback = guaranteed stability ▸ Symmetric taps = exact linear phase ▸ Feedback buys order at a price ▸ Cascade poles/zeros by hand
Learning outcomes

By the end of this lecture, you will be able to:

  • Distinguish FIR from IIR structurally, and explain why FIR is stable by construction while IIR requires a stability check.
  • Derive why symmetric FIR coefficients give exactly linear phase, and explain why no IIR or analog filter can match that guarantee.
  • Build and analyse the two simplest hand-designed filters — the FIR moving average and the IIR two-pole resonator — and compare their cost and risk.
  • Choose between FIR and IIR for a given application based on phase sensitivity, computational cost, and stability risk.
Lecture 6

Contents

Begin by comparing FIR and IIR structures, stability and phase. Then use a moving average, a one-pole low-pass and a two-pole resonator to see the trade-offs in concrete examples. The final section combines simple pole–zero sections into a multiband design.

iNotation used in this lecture
FIR
finite impulse response — feed-forward only, no feedback
IIR
infinite impulse response — feedback present, poles can be anywhere
\(M\)
FIR filter order — number of taps minus one
\(b_k,\;a_k\)
feed-forward and feedback coefficients (Lecture 4 notation)
\(r,\;\omega_0\)
pole radius and angle of a resonator/notch section
linear phase
phase exactly proportional to \(\omega\); every frequency delayed equally

Purpose of this lecture. The hand-built examples develop intuition about FIR and IIR behaviour. Lecture 7 gives systematic FIR design methods, and Lecture 8 gives systematic IIR design methods.

6.1  Two structures: FIR and IIR

Discrete-time filters fall into two categories: finite impulse response (FIR) and infinite impulse response (IIR). The names describe the impulse response, and the difference between them comes from a single structural choice. Lecture 4's LCCDE (Eq. 4.12) splits into the two cases depending on whether the feedback coefficients \(a_k\) are present at all.

Recap from Lecture 4 · the LCCDE

Every filter in this lecture is one equation with two coefficient sets: \(N\) feedback coefficients \(a_k\) acting on past outputs, and \(M+1\) feed-forward coefficients \(b_k\) acting on present and past inputs.

$$\sum_{k=0}^{N}a_k\,y[n-k]=\sum_{k=0}^{M}b_k\,x[n-k] \qquad\Longleftrightarrow\qquad H(z)=\frac{\sum_{k=0}^{M}b_kz^{-k}}{\sum_{k=0}^{N}a_kz^{-k}}$$

The key distinction is feedback. With no feedback coefficients \(a_k\), the filter is FIR. When past outputs are fed back, the denominator contains non-trivial poles and the filter is IIR.

FIR · no feedback

Set \(a_0=1\) and \(a_k=0\) for \(k\ge1\). The denominator collapses to 1, so \(H(z)\) is a polynomial in \(z^{-1}\): only zeros, and \(M\) poles stacked at \(z=0\).

$$y[n]=\sum_{k=0}^{M}b_k\,x[n-k]$$
$$H(z)=\sum_{k=0}^{M}b_kz^{-k}=b_0\prod_{k=1}^{M}\left(1-c_kz^{-1}\right)$$

The designer places only the zeros \(c_k\).

IIR · feedback present

At least one \(a_k\neq0\) for \(k\ge1\). The denominator survives, its roots are poles placed anywhere the designer likes, and stability becomes a condition to check.

$$y[n]=\sum_{k=0}^{M}b_k\,x[n-k]-\sum_{k=1}^{N}a_k\,y[n-k]$$
$$H(z)=\frac{b_0\prod_{k=1}^{M}\left(1-c_kz^{-1}\right)}{\prod_{k=1}^{N}\left(1-d_kz^{-1}\right)}$$

Both the zeros \(c_k\) and the poles \(d_k\) can be placed, which gives far more freedom in the responses an IIR filter can produce.

In the block diagrams each \(z^{-1}\) block is a unit delay; in software it is one memory location holding a past value. The FIR structure stores past inputs only. The IIR structure also stores past outputs and feeds them back, and this recursion is what makes its impulse response infinite. The same difference equations can be rearranged into structures that need less memory.

FIR (non-recursive)
Direct-form FIR block diagram: a chain of z-inverse delays on the input, each tapped by a coefficient b_k into a summation chain producing y[n]
Impulse response: finite. Drive this structure with \(\delta[n]\) and the impulse walks down the delay line, emerging as \(b_0,b_1,\ldots,b_M\) and then nothing: \(h[n]=0\) for \(n>M\), so the response lasts exactly \(M+1\) samples. Hence finite impulse response.
IIR (recursive)
Direct-form I IIR block diagram: the same feed-forward delay chain and b_k taps on the left, plus a second delay chain on the output with taps minus a_k fed back into the summation
Impulse response: infinite. In this structure the output re-enters the summation, so once the delay line has emptied the filter keeps feeding itself: \(h[n]\) decays as \(\sum_kA_k(d_k)^n\) but never reaches exactly zero. Hence infinite impulse response.
Figure 6.1.a. The two structures drawn from the same equation. Left: the feed-forward half alone, a delay line tapped by \(b_0\ldots b_M\) — Eq. (6.1) implemented literally, which is why \(h[n]\) is the tap sequence. Right: the full LCCDE, the identical feed-forward half plus a second delay line on the output whose taps \(-a_1\ldots-a_N\) return into the summation. That one added path is the entire structural difference between the families, and every entry in the table below traces back to it.
Figure 6.1.b. An impulse travelling through each structure. Play or Step advances \(n\). In the FIR structure (top, \(b_k=0.4,\,0.3,\,0.2,\,0.1\)) the impulse walks down the delay line and each tap emits its coefficient once, so \(h[n]=b_n\) and the output is exactly zero for \(n>M=3\). In the IIR structure (bottom) the output re-enters the summation through the feedback delay, so \(h[n]=a^n\) shrinks at every step but never reaches zero. Set \(a=1\) and it stops shrinking; set \(a>1\) and it grows.

Designing either filter means choosing its coefficients so that its frequency response approximates a desired response \(H_d(e^{j\omega})\), usually within stated tolerances. For an FIR filter, \(H(e^{j\omega})=\sum_{k=0}^{M}b_ke^{-jk\omega}\) and only the \(b_k\) are chosen; for an IIR filter, \(H(e^{j\omega})=\sum_{k=0}^{M}b_ke^{-jk\omega}\big/\sum_{k=0}^{N}a_ke^{-jk\omega}\) with \(a_0=1\), and both the \(b_k\) and the \(a_k\) are chosen. The two families differ in what can be asked of them:

FIR
IIR
Stability
Guaranteed — poles only at \(z=0\)
Must be checked — poles can leave the unit circle
Phase
Can be made exactly linear (Section 6.3)
Generally non-linear and not under the designer's control, as Lecture 5 Problem 5.3 already showed for analog IIR
Achievable response
Arbitrary magnitude and phase, for example a differentiator, whose magnitude rises linearly with \(\omega\)
Frequency-selective gain only (low-pass, high-pass, band-pass, band-stop), inherited from the analog prototype
Order for a sharp cutoff
High — expensive; a frequency-selective design may need \(M\approx100\)
Low — efficient; \(N=M=8\) can meet the same band-pass specification (this is exactly Lecture 5's Chebyshev/elliptic payoff)
Design method
Direct optimization on \(\{b_k\}\) — minimize mean-squared error or the maximum error (minimax) (Lecture 7)
Transform an analog prototype (Lecture 8); direct optimization on \(\{a_k,b_k\}\) is avoided — the cost surface is nonlinear, with local minima and no guarantee the poles stay inside the unit circle
Choosing between FIR and IIR
  • Linear phase required, so the waveform shape must be preserved: FIR is the only option.
  • Frequency-selective response (low-pass, high-pass, band-pass) where phase matters less: IIR, usually with far fewer coefficients.
  • Arbitrary magnitude response, such as a differentiator: FIR, by far the simpler route.

6.1.1  FIR: finite impulse response

No feedback (\(a_k=0\) for \(k\ge1\)); the output is a weighted sum of the \(M+1\) most recent inputs only:

$$ y[n]=\sum_{k=0}^{M}b_k\,x[n-k], \qquad H(z)=\sum_{k=0}^{M}b_kz^{-k}, \qquad h[n]=\begin{cases}b_n,&0\le n\le M\\0,&\text{otherwise}\end{cases} $$
(6.1)

\(h[n]\) literally is the coefficient sequence, finite by construction — there is no summation to infinity to justify.

A convenient way to see an FIR filter is to plot \(\log_{10}|H(z)|\) over the whole \(z\)-plane. Take the moving average of length \(M\), with \(b_k=1/M\) for \(k=0,\dots,M-1\), which Section 6.4 studies as Eq. (6.4):

$$ H(z)=\frac{1}{M}\sum_{k=0}^{M-1}z^{-k}=\frac{1}{M}\cdot\frac{1-z^{-M}}{1-z^{-1}}=\frac{1}{M}\cdot\frac{z^{M}-1}{z^{M-1}(z-1)}. $$

The numerator \(z^M-1\) vanishes at the \(M\) roots of unity \(e^{j2\pi k/M}\). The root at \(z=1\) cancels the factor \(z-1\), which leaves \(M-1\) zeros evenly spaced on the unit circle (\(k=1,\dots,M-1\)) and all \(M-1\) poles at \(z=0\). On the surface the poles form a single spike at the origin, and the zeros pull the surface down towards \(-\infty\). Reading the surface along the unit circle, exactly Eq. (4.16)'s geometric construction, gives the frequency response. Because the only poles are at \(z=0\), no choice of \(b_k\) can move a pole outside the unit circle: FIR stability is structural, not a design constraint.

Figure 6.1.c. The FIR surface, interactive. \(\log_{10}|H(z)|\) of the length-\(M\) moving average above. Red marks \(|H|>1\), rising towards the poles, and blue marks \(|H|<1\), falling towards the zeros; the surface is clipped at \(\pm30\) dB and drawn partly transparent so the poles (\(\times\)) and zeros (\(\circ\)) on the floor stay visible. Changing \(M\) moves only the zeros, while all \(M-1\) poles stay at \(z=0\). The black curve is the slice along \(|z|=1\), plotted on the right as the frequency response. Drag the surface to rotate it or use Change view to step through preset angles; Sweep \(\omega\) moves the orange point once around the unit circle on the surface and along the response on the right.

6.1.2  IIR: infinite impulse response

Feedback present: each output depends on past outputs as well as inputs, exactly Lecture 4's general LCCDE:

$$ y[n]=\sum_{k=0}^{M}b_k x[n-k]-\sum_{k=1}^{N}a_k y[n-k], \qquad H(z)=\frac{\sum_{k=0}^{M}b_kz^{-k}}{\sum_{k=0}^{N}a_kz^{-k}}\ \ (a_0=1) $$
(6.2)

For a stable IIR filter, partial fractions express the impulse response as a sum of decaying terms \(A_k(d_k)^n u[n]\). These terms become very small but never become exactly zero, so the impulse response is mathematically infinite.

The simplest IIR filter has a single feedback coefficient:

$$ y[n]=x[n]+a\,y[n-1], \qquad H(z)=\frac{1}{1-az^{-1}}=\frac{z}{z-a}, \qquad h[n]=a^n\,u[n]. $$

It has one pole at \(z=a\) and one zero at \(z=0\). For \(0<a<1\) the pole lies inside the unit circle on the positive real axis. The surface rises towards \(+\infty\) there, and the part of the unit circle nearest the spike is the low-frequency end, so the response is low-pass. At \(a=1\) the pole lands on the circle and \(h[n]=u[n]\) no longer decays; for \(a>1\) the pole lies outside and the causal filter is unstable. The same feedback path that buys the efficiency also puts stability into the designer's hands.

Figure 6.1.d. The one-pole surface, interactive. Slide \(a\) towards 1 and the spike moves out along the real axis to meet the unit circle, so the peak of the slice at \(\omega=0\) grows without bound. For \(a>1\) the causal filter's ROC \(|z|>a\) no longer contains \(|z|=1\), so the slice is still drawn but is no longer a frequency response.

6.2  Ideal digital filters, and the same four shapes again

FIR and IIR filters are designed to approximate the same ideal low-pass, high-pass, band-pass and band-stop shapes as analog filters. In discrete time, the responses repeat every \(2\pi\) in \(\omega\). The ideal brick-wall versions still cannot be implemented exactly because their inverse DTFT is an infinite, non-causal sinc:

LPF HPF BPF BSF Multiband
Figure 6.2.a. The four ideal digital magnitude shapes, drawn over one period \(-\pi\le\omega\le\pi\), plus a multiband example: several pass/stop regions built from the same brick-wall vocabulary, all equally unbuildable in ideal form.
Figure 6.2.b. The ideal shapes, interactive. Choose a shape and drag its band edges; switch to three periods to see \(|H(e^{j\omega})|\) repeat every \(2\pi\). The right panel is the inverse DTFT of the chosen shape for \(-20\le n\le 20\): a sinc, or a sum of sincs, whose samples decay only as \(1/|n|\) and are non-zero for \(n<0\) (shaded). Moving an edge changes how fast \(h[n]\) oscillates but never makes it finite or causal, which is why every realizable filter in this lecture can only approximate these shapes.

Both structures of Section 6.1 can only approximate these shapes. Lecture 7 develops FIR design methods, while Lecture 8 develops IIR design from analog prototypes.

6.3  Why FIR can do what no analog filter can: exact linear phase

An FIR filter can achieve exact linear phase by using a symmetric coefficient sequence:

$$ b_k=b_{M-k}\ \ \text{(symmetric)} \quad\Longrightarrow\quad H(e^{j\omega})=|H(e^{j\omega})|\,e^{-j\omega M/2} $$
(6.3)

The phase is exactly \(-\omega M/2\), so every passed frequency component is delayed by the same \(M/2\) samples. The filter can therefore change the amplitude spectrum without changing the waveform shape, apart from a fixed delay. General causal IIR filters cannot provide this exact guarantee.

FIR pays with order

A sharp transition needs a long, symmetric coefficient sequence — large \(M\), many multiplies per output sample.

IIR pays with phase

The same sharpness costs a handful of poles (Lecture 5's whole point) — but the phase that comes with them is not yours to choose.

This leads to the central trade-off. FIR filters are attractive when waveform shape must be preserved, for example in audio or biomedical signals. IIR filters are attractive when low computational cost is more important and some phase distortion is acceptable.

6.4  The simplest FIR low-pass: the moving average

Average the last \(M\) samples and you already have a low-pass filter, with no design procedure at all:

$$ y[n]=\frac{1}{M}\sum_{k=0}^{M-1}x[n-k], \qquad H(z)=\frac{1}{M}\sum_{k=0}^{M-1}z^{-k}=\frac{1}{M}\cdot\frac{1-z^{-M}}{1-z^{-1}} $$
(6.4)

All \(M\) coefficients equal \(1/M\), so Eq. (6.3)'s symmetry condition is satisfied trivially — a moving average is linear-phase for free, delaying every frequency by exactly \((M-1)/2\) samples.

EXAMPLE 6.1 · The two-tap averager as an FIR low-pass

For \(M=2\): \(y[n]=0.5x[n]+0.5x[n-1]\). Find \(H(z)\), its zero, and \(|H(e^{j\omega})|\) at \(\omega=0\) and \(\omega=\pi\).

1
Transform

\(h[n]=0.5\delta[n]+0.5\delta[n-1]\), so \(H(z)=0.5+0.5z^{-1}=0.5(1+z^{-1})\), a single zero at \(z=-1\) (\(\omega=\pi\)) and a pole at \(z=0\) from the \(z^{-1}\) term.

2
DC

\(H(e^{j0})=0.5(1+1)=1\): a constant input passes through unattenuated — averaging cannot change a signal that is not changing.

3
Nyquist

\(H(e^{j\pi})=0.5(1+e^{-j\pi})=0.5(1-1)=0\): the fastest-alternating sequence, \((-1)^n\), is annihilated completely — exactly what the zero at \(z=-1\) guarantees, and exactly the behaviour Eq. (2.16)'s ladder predicted for the highest discrete-time frequency.

MATLAB corner for Example 6.1

This script sweeps the averager length \(M\) and confirms Eq. (6.3)'s promise directly: the phase stays perfectly linear no matter how the magnitude shape changes.

Goal: plot the magnitude and phase of a moving-average filter for several \(M\), and verify the phase is exactly linear (a straight line) in every case.

moving_average_demo.m
MATLAB
%% moving_average_demo.m - FIR symmetry buys exact linear phase (Eq. 6.3)
Ms = [2 4 8 16];
w = linspace(0, pi, 1000);    % digital frequency (rad/sample)
figure('Color','w','Position',[100 100 700 500]);
 
colors = lines(numel(Ms));
subplot(2,1,1); hold on;
subplot(2,1,2); hold on;
 
for i = 1:numel(Ms)
    M = Ms(i);
    b = ones(1,M)/M;                 % moving-average taps
    H = freqz(b, 1, w);              % frequency response on [0,pi]
 
    subplot(2,1,1);
    plot(w, 20*log10(abs(H)+eps), 'Color', colors(i,:), 'LineWidth', 1.4);
 
    subplot(2,1,2);
    ph = unwrap(angle(H));
    plot(w, ph, 'Color', colors(i,:), 'LineWidth', 1.4);
end
 
% Magnitude plot
subplot(2,1,1);
grid on;
xlabel('\omega (rad/sample)');
ylabel('Magnitude (dB)');
title('|H(e^{j\omega})|: sharper roll-off with larger M');
legend(arrayfun(@(M)sprintf('M=%d',M), Ms, 'UniformOutput', false), 'Location','southwest');
 
% Phase plot
subplot(2,1,2);
grid on;
xlabel('\omega (rad/sample)');
ylabel('phase (rad)');
title('Phase: a straight line for every M (exact linear phase)');
Magnitude in dB and unwrapped phase of moving-average filters for M=2,4,8,16
Figure 6.4.a. Reading the moving-average results. As the length \(M\) increases, the main lobe becomes narrower and more zeros appear, so the filter separates low and high frequencies more sharply. This improvement requires more taps and therefore more computation and delay. Between the magnitude zeros, the phase is a straight line, which confirms linear phase. The apparent \(\pi\)-radian jumps occur where the real-valued frequency response changes sign at a zero; they do not represent a sudden change in physical delay.

6.4.1  The IIR twin: a one-pole low-pass, and a running audio-EQ example

Trade the moving average's feed-forward taps for one feedback term and the same low-pass job is done with a single pole instead of \(M\) taps — the exponential smoother:

$$ y[n]=(1-a)x[n]+a\,y[n-1], \qquad H(z)=\frac{1-a}{1-az^{-1}}, \qquad 0<a<1 $$
(6.5)

The moving-average FIR and the one-pole IIR are two simple low-pass filters. Both have unity gain at DC, \(H(1)=1\). The FIR response becomes sharper by adding taps. The IIR response is adjusted by moving one pole with the coefficient \(a\), so it can be more efficient, but its phase is not linear. More complicated equalizers can be built by cascading several first- or second-order sections tuned to different frequency bands.

EXAMPLE 6.2 · Designing a one-pole low-pass shelf for an audio EQ

A bass-shelf stage in a 3-band digital audio EQ needs a one-pole low-pass (Eq. 6.5) with cutoff \(f_c=200\,\text{Hz}\) at \(f_s=48\,\text{kHz}\). Using the design rule \(a=e^{-2\pi f_c/f_s}\), find \(a\), write the difference equation, and compare its cost and stability margin to Example 6.1's moving average.

1
Solve for \(a\)

\(a=e^{-2\pi(200)/48000}=e^{-0.02618}\approx0.9742\).

2
Difference equation

With \(1-a\approx0.0258\): \(y[n]=0.0258\,x[n]+0.9742\,y[n-1]\).

3
Cost

One pole, one multiply-add in feedback plus one in the feed-forward path: 2 multiplies, order 1, regardless of how low \(f_c\) is set. An FIR moving average reaching a comparably low 200 Hz cutoff at 48 kHz would need roughly \(M\approx f_s/f_c\approx240\) taps — the same order-vs-structure trade Example 6.3's resonator makes against a long FIR band-pass, now for a low-pass shelf.

4
Stability margin

The pole sits at \(z=a\approx0.974\), safely inside the unit circle, but a fixed-point implementation that rounds \(a\) up past 1 makes the filter's DC gain unbounded — unlike Example 6.1's moving average, whose only pole is fixed exactly at \(z=0\) and cannot be dislodged by rounding.

MATLAB corner for Example 6.2

This script builds Example 6.2's bass-shelf filter, plots its pole, magnitude, and phase, and checks the design rule's \(-3\,\text{dB}\) point numerically against the target \(f_c\).

Goal: confirm \(a=e^{-2\pi f_c/f_s}\) places the measured \(-3\,\text{dB}\) point at (approximately) the target \(f_c\), and show the phase curving smoothly rather than as a straight line.

onepole_iir_demo.m
MATLAB
%% onepole_iir_demo.m - Example 6.2's audio-EQ bass shelf (Eq. 6.5)
fc = 200; fs = 48000;
a = exp(-2*pi*fc/fs); % Eq. (6.5) design rule
b = [1-a]; den = [1 -a];
 
figure('Color','w');
subplot(1,3,1); zplane(b, den); title('pole at z = a');
[H,f] = freqz(b, den, 4096, fs);
subplot(1,3,2); plot(f, 20*log10(abs(H)), 'LineWidth',1.4); grid on;
xlim([0 2000]); xline(fc,'r--','f_c'); yline(-3,'k:','-3 dB');
title('magnitude'); xlabel('Hz');
subplot(1,3,3); plot(f, unwrap(angle(H))*180/pi, 'LineWidth',1.4); grid on;
xlim([0 2000]); title('phase (not linear)'); xlabel('Hz');
 
% verify the design rule numerically
[~, idx] = min(abs(20*log10(abs(H)) - (-3)));
fprintf('designed fc = %.1f Hz, measured -3dB point = %.1f Hz\n', fc, f(idx));
Figure 6.4.b — pole-zero, magnitude and phase produced by onepole_iir_demo.m
Figure 6.4.b. Checking the one-pole IIR design. The magnitude reaches \(-3\,\text{dB}\) at 200 Hz, so the pole coefficient chosen from Eq. (6.5) meets the cutoff target. The response then rolls off smoothly because this is only a first-order filter. The phase curve is not a straight line: different frequency components experience different delays. Compare this with the moving-average FIR result in Figure 6.4.a, where the phase is linear between the zeros.
Figure 6.4.c. Following the pole–zero sweep. The filter has one pole at \(z=a_1\) and one zero at \(z=-b_1\). As \(a_1\) increases towards 1, the pole moves closer to the unit circle near \(\omega=0\). The low-frequency gain rises and the response becomes sharper. As \(b_1\) increases towards 1, the zero moves towards \(z=-1\), which corresponds to \(\omega=\pi\), so the high-frequency gain falls towards zero. The animation separates the two effects: nearby poles increase the response, while nearby zeros reduce it.
Figure 6.4.d. The sweep of Figure 6.4.c, under your control. \(H(z)=(1+b_1z^{-1})/(1-a_1z^{-1})\) has its pole at \(z=a_1\) and its zero at \(z=-b_1\). Drag either along the real axis or use the sliders, and drag the point on the unit circle to choose \(\omega\). The magnitude is the length of the zero vector divided by the length of the pole vector, \(d_z/d_p\) (Section 4.8), read out below the plots. Play sweep repeats the animation and leaves faint traces: first \(a_1\) from 0 to 0.9 (red), then \(b_1\) from 0 to 1 with \(a_1=0.9\) (blue).

6.5  The simplest IIR band-pass: the two-pole resonator

Place one conjugate pole pair close to the unit circle at angle \(\omega_0\) and, exactly as Example 4.6's notch used zeros to create a null, a resonator uses poles to create a peak — the geometric method of Section 4.8 read in reverse:

$$ H(z)=\frac{1}{1-2r\cos\omega_0\,z^{-1}+r^2z^{-2}}, \qquad p_{1,2}=re^{\pm j\omega_0},\ \ r\lesssim1 $$
(6.6)

At \(\omega=\omega_0\), the evaluation point on the unit circle is closest to the pole, so the magnitude reaches a peak. Moving the pole radius \(r\) closer to 1 reduces this distance, producing a taller and narrower resonance. The pole angle sets the centre frequency, while the pole radius sets the bandwidth and ringing time.

Adding zeros at \(z=\pm1\) to Eq. (6.6) gives a band-pass resonator:

$$ H(z)=\frac{1-z^{-2}}{1-2r\cos\omega_0\,z^{-1}+r^2z^{-2}}=\frac{(z-1)(z+1)}{\left(z-re^{j\omega_0}\right)\left(z-re^{-j\omega_0}\right)}. $$

The zeros at \(z=1\) and \(z=-1\) force the response to zero at \(\omega=0\) and \(\omega=\pi\). The conjugate poles at \(re^{\pm j\omega_0}\) create peaks near \(\pm\omega_0\). Reading the surface around the unit circle therefore gives a response that starts at zero, rises to a resonance near \(\omega_0\), and returns to zero at Nyquist.

Figure 6.5.a. The resonator surface, interactive. Raise \(r\) towards 1 and the two spikes approach the circle, so the peak of the slice grows taller and narrower; change \(\omega_0\) and the peak follows the pole angle. The zeros hold the response at zero at \(\omega=0\) and \(\omega=\pi\) for every setting.
EXAMPLE 6.3 · Designing a two-pole resonator, and checking its cost

Design a resonator peaking at \(f_0=1\,\text{kHz}\), \(f_s=8\,\text{kHz}\), with \(r=0.97\). Give the difference equation and compare its cost (multiplies, order) to an FIR filter that could produce a comparably narrow peak.

1
Angle

By Eq. (3.13), \(\omega_0=2\pi f_0/f_s=2\pi(1000)/8000=\pi/4\).

2
Coefficients

\(2r\cos\omega_0=2(0.97)(0.7071)\approx1.372\), \(r^2\approx0.9409\), so \(H(z)=1/(1-1.372z^{-1}+0.9409z^{-2})\) and

$$y[n]=x[n]+1.372\,y[n-1]-0.9409\,y[n-2].$$
3
Cost

Two multiplies, two delays, order 2 — regardless of how narrow \(r=0.97\) makes the peak. An FIR filter reaching a comparably narrow passband would need dozens of taps (Figure 6.4.a's trend: sharper needs longer), i.e. tens of multiplies. This is Lecture 5's whole point about IIR efficiency, now demonstrated at the smallest possible scale: two poles do here what would need a much longer FIR filter.

4
The other side of the ledger

\(|p|=0.97<1\) so it is stable, but only just: rounding the coefficients in a fixed-point implementation could push a pole outside the unit circle. No such risk exists for the FIR alternative, whose only pole sits at \(z=0\) regardless of coefficient rounding — the stability-must-be-checked row of Section 6.2's table, concretely.

MATLAB corner for Example 6.3

This script builds Example 6.3's resonator, sweeps \(r\) to show the peak sharpen exactly as Section 4.8's geometric argument predicts, and overlays a long FIR band-pass of comparable width to make the order comparison from Step 3 visible.

Goal: confirm the resonator's peak sharpens as \(r\to1\), and compare its 2-pole cost to an FIR filter needed for a similarly narrow passband.

resonator_vs_fir_fixed.m
MATLAB
% resonator_vs_fir_fixed.m - two IIR poles vs. many FIR taps (Eq. 6.6, Sec. 4.8)
w0 = pi/4;
w = linspace(0, pi, 2000);
figure('Color','w');
hold on;
 
rs = [0.8 0.9 0.97];
colors = lines(numel(rs));
for i = 1:numel(rs)
    r = rs(i);
    b = 1;
    a = [1, -2*r*cos(w0), r^2];        % Eq. (6.6)
    Hi = abs(freqz(b, a, w));          % frequency response magnitude
    plot(w, Hi, 'Color', colors(i,:), 'LineWidth', 1.8);
end
 
% FIR bandpass design (fallback if fir1 not available)
Nfir = 60;                                % FIR order
Wp = [w0-0.05, w0+0.05];                 % passband in rad/sample
Wn = Wp/pi;                              % normalized to [0,1] for fir1
 
if exist('fir1','file')
    bfir = fir1(Nfir, Wn, 'bandpass');
else
    % simple windowed-sinc bandpass fallback
    M = Nfir;
    n = 0:M;
    fc1 = (Wp(1))/pi; fc2 = (Wp(2))/pi;  % normalized
    hbp = sinc(2*fc2*(n-M/2)).* (2*fc2) - sinc(2*fc1*(n-M/2)).*(2*fc1);
    wwin = 0.5*(1 - cos(2*pi*n/(M)));    % Hann (periodic) window
    bfir = hbp .* wwin;
end
 
Hfir = abs(freqz(bfir, 1, w));
% scale FIR to match peak of the narrowest IIR for fair visual comparison
peakIIR = max(abs(freqz(1, [1 -2*rs(end)*cos(w0) rs(end)^2], w)));
scale = peakIIR / max(Hfir);
plot(w, scale*Hfir, 'k--', 'LineWidth', 1.6);
 
grid on;
legend_entries = [arrayfun(@(r)sprintf('r=%.2f',r), rs, 'UniformOutput', false), ...
                  {sprintf('FIR, order %d (scaled)', Nfir)}];
legend(legend_entries, 'Location', 'northwest');
xlabel('\omega (rad/sample)'); ylabel('|H(e^{j\omega})|');
title('2-pole IIR resonator vs. a 60-tap FIR: same width, different cost');
Two-pole IIR resonator magnitude for r=0.80, 0.90, 0.97 overlaid with a scaled 60-tap FIR band-pass
Figure 6.5.b. IIR resonator and FIR filter compared. The pole angle fixes the centre frequency of the IIR resonance. Moving the radius \(r\) closer to 1 brings the poles nearer the unit circle, making the peak taller and narrower while leaving its centre in the same place. Only two poles are needed. The FIR design needs about 60 taps to obtain a similarly narrow band, which illustrates the efficiency advantage of IIR filters. The trade-off is that the IIR response has nonlinear phase and becomes more sensitive as its poles approach the stability boundary.

6.6  Parametric design: cascading pole–zero building blocks

A resonator, notch or shelf can be designed as a simple pole–zero section. Several sections can then be connected in series to build a more complicated response. Cascading multiplies their transfer functions, so a three-band equalizer can be written as

$$ H_{\text{eq}}(z)=H_1(z)\,H_2(z)\,H_3(z), \qquad \text{each } H_i \text{ a low-order resonator/notch section.} $$
(6.7)
Two piecewise-constant desired magnitude specifications, each drawn beneath a block diagram showing it realised as a cascade of two and of three sub-filters
Figure 6.6.a. Why cascading is the natural way to meet a multi-band specification. A desired response \(H_d(e^{j\omega})\) made of separated bands at different gains is not one filter to be designed at once; each band is handed to its own section, and the sections are placed in series. Two bands need two sections (top), three need three (bottom), and each section is designed against the single, simple feature it owns.
Figure 6.6.b. A multi-band specification, one section per band. The dashed line is the desired \(H_d(e^{j\omega})\) in dB; drag a band's dot to change its gain, or a handle at the top to move a band edge. Each band is given to one second-order section, drawn in that band's colour: a low shelf for the lowest band, a peak for a middle band and a high shelf for the highest. The cascade (black) is the sum of the section curves in dB. Switch between two and three bands for the two cases of Figure 6.6.a; the readout compares the cascade with the specification at each band centre.

Each section controls one local feature, such as a peak, notch or shelf. Because transfer functions multiply, their magnitude responses add when plotted in decibels. This approach works well for a small number of separated features; precise band-edge specifications are better handled by the systematic methods in Lectures 7 and 8.

Building intuition: watch the poles and zeros move

Use a pole–zero explorer to connect geometry with the response. Moving a pole towards the unit circle raises and narrows the nearby peak. Moving a zero onto the unit circle creates an exact null at its angle. The figures in this lecture are fixed examples of the same continuous relationship.

As a worked case, consider a three-band graphic equalizer, the kind of tone control found in audio players and mixing desks. The aim is independent control of the bass, mid and treble: a low shelf boosts or cuts low frequencies, a peak lifts a band around the middle of the spectrum, and a high shelf boosts or cuts high frequencies. Each band is realised by one second-order pole–zero section, and the three sections are cascaded per Eq. (6.7). Figure 6.6.c shows one such design.

H1(z): bass boost, a low-frequency shelf H2(z): band emphasis, a mid-frequency peak H3(z): treble boost, a high-frequency shelf
The three sections' combined equalizer response, in yellow, over the individual band curves The cascaded system surface: all three pole-zero pairs on one z-plane, with the product response in yellow over the three individual curves
Figure 6.6.c. Interpreting the three-band equalizer. The top row shows the sections separately: \(H_1\) controls the bass, \(H_2\) adds a mid-band peak, and \(H_3\) controls the treble. The yellow curve at the bottom is the cascade. Each local feature remains centred at the frequency chosen for its section, while overlapping gains combine. Since gains add in dB, raising one section lifts the combined curve mainly in that section's frequency range. The bottom panel places all three pole–zero pairs on one \(z\)-plane: because \(H(z)=H_1(z)H_2(z)H_3(z)\), the cascade has every section's poles and zeros.
Figure 6.6.d. Building a cascade by hand. Each section \(H_i(z)\) has one conjugate pole pair (\(\times\)) and one conjugate zero pair (\(\circ\)); drag either in the upper half of the \(z\)-plane and its conjugate follows. A section whose poles lie closer to the unit circle than its zeros makes a peak, and the reverse makes a dip. Switch sections on and off: each changes the cascade (black) mainly near its own angle, and the cascade is the sum of the section curves in dB, as Eq. (6.7) implies.
Figure 6.6.e. The three-band equalizer, interactive. At \(f_s=48\) kHz: a low shelf at 200 Hz (Example 6.2's cutoff), a peak at 1 kHz and a high shelf at 4 kHz, each a second-order pole–zero section with the coefficients listed below the plot. Set each gain with its slider, or drag a handle (sideways for frequency, up and down for gain). The cascade (black) is the sum of the three curves in dB, so each control lifts or cuts the total mainly in its own band.

?Problems with solutions

Work each one before reading the solution.

PROBLEM 6.1

A three-tap FIR filter has \(b_0=b_2=0.25\), \(b_1=0.5\). Verify it satisfies Eq. (6.3)'s symmetry condition, and find its exact phase delay in samples.

1
State the symmetry condition

With \(M=2\), Eq. (6.3) requires \(b_k=b_{2-k}\).

2
Check the coefficients

\(b_0=b_2=0.25\ \checkmark\), and \(b_1=b_1\) trivially.

3
Read off the phase

The phase is exactly \(-\omega M/2=-\omega\).

Result

Symmetric, so linear phase, with a delay of exactly 1 sample.

This tapered three-tap averager differs from Example 6.1's two-tap one. By the window intuition of Lecture 5 (Section 5.2, Step 4), the weights \(0.25,0.5,0.25\) give lower sidelobes than equal weights, at the cost of a slightly wider main lobe.

PROBLEM 6.2

A resonator (Eq. 6.6) with \(r=0.995\) needs 16-bit fixed-point coefficients. Explain, without computing anything, why this design is riskier to implement than Example 6.1's moving average at the same word length.

1
Resonator: stability margin

The resonator is stable only if its pole radius satisfies \(|p|<1\) (Lecture 4, Eq. 4.8). With \(r=0.995\) the pole sits only \(0.005\) inside the unit circle.

2
Effect of quantisation

A small rounding error in the coefficients \(2r\cos\omega_0\) or \(r^2\) can push the effective pole radius past 1, making the filter unstable (Section 6.2's table, Example 6.3 Step 4).

3
Moving average: no exposure

Its only pole is fixed at \(z=0\) by structure (Eq. 6.1), so no coefficient rounding can move it outside the unit circle.

Result

The resonator's stability rests on a numerical margin that quantisation can erode; the FIR's is guaranteed by structure.

PROBLEM 6.3

A biomedical ECG system must remove 50 Hz mains hum without distorting the QRS complex's waveform shape. Which family, FIR or IIR, is the safer default, and why? (Compare to Example 4.7's IIR notch.)

1
What the application needs

In an ECG the waveform shape itself is the clinically meaningful signal.

2
FIR option

A symmetric linear-phase FIR notch (Eq. 6.3) delays every frequency component of the QRS complex by the same amount, so the complex emerges time-shifted but otherwise undistorted (Section 6.3).

3
IIR option (Example 4.7)

It removes the same 50 Hz tone with far fewer coefficients, but its non-linear phase near the notch delays different components by different amounts, subtly distorting the shape. That is usually acceptable for a communications signal, less so when a clinician reads morphology off the waveform.

Result

FIR is the safer default for the ECG.

PROBLEM 6.4*

Three resonator sections (Eq. 6.6) are cascaded per Eq. (6.7), each with a different \(\omega_0\) but the same \(r\). Explain why the combined magnitude in dB is the sum of the three individual magnitude curves in dB, and what this implies for placing the three peaks close together. (* optional)

1
Cascade multiplies

\(H=H_1H_2H_3\) (Eq. 6.7), so \(|H|=|H_1||H_2||H_3|\).

2
Logarithm turns products into sums
$$20\log_{10}|H|=\sum_i20\log_{10}|H_i|$$
3
Peaks placed close together

Each resonator's response has not decayed back to \(0\,\text{dB}\) at its neighbours' centre frequencies, so the sum raises the floor between the peaks and the bands interact.

Result

The dB curves add. Keep the peaks well separated relative to each section's \(3\,\text{dB}\) width (set by \(r\), Example 6.2) so the bands stay independent.

This is the same separation logic Lecture 5's frequency transformations relied on for clean band edges.

Summary and key formulas

The reference sheet: the two structures, the trade between them, and the two simplest hand-built filters of each type.

FIR · Eq. (6.1)
$$H(z)=\sum_{k=0}^{M}b_kz^{-k}$$
IIR · Eq. (6.2)
$$H(z)=\frac{\sum_k b_kz^{-k}}{\sum_k a_kz^{-k}}$$
Exact linear phase · Eq. (6.3)
$$b_k=b_{M-k}\Rightarrow \angle H=-\omega M/2$$
Moving average · Eq. (6.4)
$$y[n]=\tfrac{1}{M}\textstyle\sum_{k=0}^{M-1}x[n-k]$$
One-pole IIR · Eq. (6.5)
$$H(z)=\tfrac{1-a}{1-az^{-1}}$$
Resonator · Eq. (6.6)
$$H(z)=\tfrac{1}{1-2r\cos\omega_0 z^{-1}+r^2z^{-2}}$$
Cascade · Eq. (6.7)
$$H_{\text{eq}}=H_1H_2H_3,\ \ \text{dB adds}$$
  • The same four ideal shapes as analog filters (Lecture 5) return in discrete time, periodic in \(\omega\), and are equally unbuildable in their ideal form.
  • FIR has no feedback, hence guaranteed stability (only a pole at \(z=0\)) and, with symmetric coefficients, exactly linear phase — a guarantee no analog or IIR prototype in this module can match.
  • IIR has feedback, hence a much lower order for a given sharpness (inherited directly from Lecture 5's Chebyshev/elliptic advantage), at the cost of non-linear phase and a stability condition that must be checked, not assumed.
  • A moving average is the simplest FIR low-pass: all-equal taps, linear phase for free, a zero at \(\omega=\pi\) that nulls the fastest-alternating sequence exactly.
  • A one-pole IIR low-pass (Eq. 6.5) does the same job with a single feedback term instead of \(M\) taps, at the cost of non-linear phase — the smallest possible instance of Section 6.3's trade.
  • A two-pole resonator is the simplest IIR band-pass: one conjugate pole pair near the circle, peak sharpness set by how close \(r\) is to 1, at a stability cost that grows as \(r\to1\).
  • Cascading low-order pole/zero sections (Eq. 6.7) is hand-built parametric design — effective for a few separated features, superseded by systematic methods once the specification is a single precisely-shaped band edge.
  • Next: Lecture 7 builds FIR filters systematically (windowing, Parks-McClellan); Lecture 8 builds IIR filters systematically by transforming Lecture 5's analog prototypes with the bilinear transform.