NivaarExam PrepOfficial exam papers ↗

22-Elec-B1 Digital Signal Processing · May 2014

Question 2 of 7: FIR and IIR Notch Filter Design from a DFT Spectrum

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

Paper format. National Exams May 2014, 07-Elec-B1 Digital Signal Processing — 3 hours, open book, any non-communicating calculator permitted. Seven questions are printed; five constitute a complete paper and the first five appearing in the answer book are marked. All questions are of equal value (20 marks each; the printed marking scheme gives the sub-part split). A table of symbols, trigonometric identities, DFT definitions, DTFT tables and z-transform tables is supplied at the back of the paper. All seven questions are solved below, so the set works as a complete study resource.

Reference texts. Proakis & Manolakis, Digital Signal Processing, 4th ed. (z-transform and ROC, Ch. 3; DFT and FFT, Ch. 7; filter structures, Ch. 9); Oppenheim & Schafer, Discrete-Time Signal Processing, 3rd ed. (the DTFT symmetry and transform tables reproduced at the back of this paper are Tables 2.1–2.3 of that text); B. P. Lathi, Linear Systems and Signals, 2nd ed. (discrete-time convolution and system response).

Question 2: FIR and IIR Notch Filter Design from a DFT Spectrum (20 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. $F_s = 48$ kHz; a 64-point DFT of the sampled sequence; the two interfering components appear at bins $k = 8$ and $k = 16$, with their conjugate images at $k = 56$ and $k = 48$ as expected for a real sequence; a d.c. bin is also present.

Find. (a) the two analogue interferer frequencies; (b) the causal real-coefficient FIR notch $H_{notch}(z)$; (c) its pole-zero plot, a minimum-multiplier realisation and its operation count; (d) the frequencies blocked if the same filter is fed at 10 kHz; (e) a narrower-notch IIR replacement with its structure.

[Figure not reproduced: Figure 2 redrawn: magnitude of the 64-point DFT. The four heavy stems at k = 8, 16, 48 and 56 are the two interferers and their conjugate images; everything else is broadband signal content. See the official exam paper.]

Approach. Convert bin index to analogue frequency, convert that to digital radian frequency, place a conjugate pair of zeros on the unit circle at each unwanted frequency, then factor the result into second-order sections to minimise multipliers. For part (e), pull a matching pole in behind each zero along the same radial line.

  1. (a) Map DFT bin index to analogue frequency. The $k$-th bin of an $N$-point DFT of a sequence sampled at $F_s$ sits at

    $$F_k = \frac{k F_s}{N} = \frac{k \times 48\,000}{64} = 750k \;\text{Hz}.$$

    Hence $F_1 = 750 \times 8 = 6\,000$ Hz and $F_2 = 750 \times 16 = 12\,000$ Hz. The stems at $k = 56$ and $k = 48$ are not extra tones: for real $x[n]$ the DFT is conjugate-symmetric, $X[N-k] = X^{*}[k]$, so each real sinusoid always shows up as a mirrored pair. Both frequencies satisfy the stated $0 \lt F_1 \lt F_2 \lt 24$ kHz, so neither is aliased.

    $$\boxed{F_1 = 6\;\text{kHz}, \qquad F_2 = 12\;\text{kHz}.}$$
  2. (b) Place zeros on the unit circle at the offending digital frequencies. The digital radian frequencies are

    $$\omega_1 = \frac{2\pi F_1}{F_s} = \frac{2\pi (6000)}{48000} = \frac{\pi}{4}, \qquad \omega_2 = \frac{2\pi F_2}{F_s} = \frac{\pi}{2}.$$

    A zero exactly at $z = e^{j\omega_0}$ forces $H(e^{j\omega_0}) = 0$, which annihilates that tone completely. Real coefficients require zeros in conjugate pairs, and each pair contributes a real second-order factor:

    $$H_{notch}(z) = \prod_{i=1}^{2}\left(1 - 2\cos\omega_i\, z^{-1} + z^{-2}\right) = \left(1 - \sqrt{2}\,z^{-1} + z^{-2}\right)\left(1 + z^{-2}\right),$$

    using $2\cos(\pi/4) = \sqrt{2}$ and $2\cos(\pi/2) = 0$. Expanding,

    $$\boxed{H_{notch}(z) = 1 - \sqrt{2}\,z^{-1} + 2 z^{-2} - \sqrt{2}\,z^{-3} + z^{-4}.}$$

    All four taps are real and the filter is causal (only non-negative powers of $z^{-1}$), as required. The tap set $\{1, -\sqrt{2}, 2, -\sqrt{2}, 1\}$ is symmetric, so the filter also has exactly linear phase with a constant group delay of 2 samples.

  3. (c) Pole-zero plot. The four zeros sit on the unit circle at $e^{\pm j\pi/4}$ and $e^{\pm j\pi/2}$; because $H_{notch}(z)$ is a fourth-order polynomial in $z^{-1}$, all four poles are stacked at the origin.

    Re[z]Im[z]UCe^(j pi/4)e^(-j pi/4)e^(j pi/2)e^(-j pi/2)4th orderROC: all z except z = 0
    Pole-zero diagram of H_notch(z): four unit-circle zeros at the notch frequencies, a fourth-order pole at the origin, ROC the whole plane except z = 0.

    Rather than implementing the five-tap transversal filter directly, keep the cascade of the two second-order sections: the first has the single non-trivial coefficient $-\sqrt{2}$, and the second has coefficients $\{1, 0, 1\}$, i.e. no multiplier at all. That is the minimum-multiplication structure.

    x[n]z-1z-11-sqrt(2)1w[n]Section 1: 1 - sqrt(2) z-1 + z-2w[n]z-1z-111y[n]Section 2: 1 + z-2
    Minimum-multiplier realisation: two cascaded second-order transversal sections. Only one true multiplier appears, in section 1.

    Counting per output sample: section 1 forms $x[n] + x[n-2]$ (one addition) and then subtracts $\sqrt{2}\,x[n-1]$ (one multiplication and one subtraction); section 2 forms $w[n] + w[n-2]$ (one addition). Storage is two delay registers per section plus the one coefficient.

    $$\boxed{1 \text{ multiplication}, \quad 3 \text{ additions/subtractions}, \quad 4 \text{ delay registers} + 1 \text{ coefficient word.}}$$

    For comparison, the direct five-tap form needs four multiplications and four additions; exploiting the tap symmetry brings that to two multiplications and four additions. The cascade wins because the $\omega_2 = \pi/2$ section is coefficient-free, and even the remaining multiplier could be traded for a shift-and-add pair since $\sqrt{2} \approx 1 + \tfrac{1}{4} + \tfrac{1}{8} + \tfrac{1}{32}$ if a small coefficient error were acceptable.

  4. (d) The filter blocks fixed digital frequencies. The zeros are pinned to $\omega = \pi/4$ and $\pi/2$ in the discrete-time domain; they do not know what sampling rate produced the samples. Re-mapping to analogue frequency at the new rate $F_s^{\prime} = 10$ kHz,

    $$F = \frac{\omega F_s^{\prime}}{2\pi} \;\Rightarrow\; F_1^{\prime} = \frac{(\pi/4)(10\,000)}{2\pi} = 1250 \text{ Hz}, \qquad F_2^{\prime} = \frac{(\pi/2)(10\,000)}{2\pi} = 2500 \text{ Hz}.$$

    So the same code now removes 1.25 kHz and 2.5 kHz — the notches scale with the sampling rate, which is exactly why a rate change silently de-tunes a fixed-coefficient filter.

    $$\boxed{F_1^{\prime} = 1.25\;\text{kHz}, \qquad F_2^{\prime} = 2.5\;\text{kHz.}}$$
  5. (e) Add poles just behind the zeros to narrow the notches. The FIR notch is wide because there is nothing to restore the gain away from the null. Placing a pole at the same angle but at radius $r$ slightly less than 1 cancels the zero except very close to the notch frequency. Part (e) also asks for the d.c. component, so a real zero at $z = 1$ and a real pole at $z = r$ are added. With $r = 0.95$:

    $$H_{IIR}(z) = \frac{(1 - z^{-1})\left(1 - \sqrt{2} z^{-1} + z^{-2}\right)\left(1 + z^{-2}\right)}{(1 - 0.95 z^{-1})\left(1 - 1.34350 z^{-1} + 0.9025 z^{-2}\right)\left(1 + 0.9025 z^{-2}\right)},$$

    where $2r\cos(\pi/4) = 1.34350$ and $r^{2} = 0.9025$. The structure is elegant: every denominator coefficient is the corresponding numerator coefficient scaled by $r^{k}$, i.e.

    $$\boxed{H_{IIR}(z) = \frac{N(z)}{N(z/r)}, \qquad N(z) = 1 - 2.41421 z^{-1} + 3.41421 z^{-2} - 3.41421 z^{-3} + 2.41421 z^{-4} - z^{-5}.}$$

    All poles have radius $r = 0.95 \lt 1$, so the filter is stable, and the ROC $|z| \gt 0.95$ makes it causal.

    x[n](1 - z-1)/ (1 - 0.95 z-1)(1 - 1.41421 z-1 + z-2)/ (1 - 1.34350 z-1 + 0.9025 z-2)(1 + z-2)/ (1 + 0.9025 z-2)y[n]d.c. notch6 kHz notch12 kHz notch
    Cascade realisation of the IIR notch: a first-order d.c. section followed by two second-order notch sections.

    Each second-order section is implemented canonically in Direct Form II, which needs only two delay elements because the feedback and feedforward arms share them:

    x[n]w[n]z-1w[n-1]z-1w[n-2]1.34350-0.9025y[n]-1.41421Section 2 in canonic Direct-Form II (2 delays, 3 multipliers)
    Section 2 of the IIR notch in canonic Direct-Form II. The same skeleton, with its own coefficients, realises each section.

    The improvement is quantitative, not merely qualitative. Measuring the −3 dB width of the $\pi/4$ notch against the local passband level between the two nulls gives $0.4145$ rad/sample for the FIR ($\approx 3167$ Hz at 48 kHz) but only $0.0999$ rad/sample for the IIR ($\approx 763$ Hz) — a factor of $4.15$ narrower, so far less of the wanted signal is destroyed alongside the interference.

    0pi/4pi/23pi/4pi0-20-40-60pi/4pi/2|H| [dB, peak-normalised]omega [rad/sample]FIR notch (order 4)IIR notch (r = 0.95)
    Magnitude responses on a dB scale, each normalised to its own peak. The FIR notch (grey, dashed) removes a wide band around each tone; the IIR notch (blue) is nearly flat everywhere except in two very narrow nulls.

Check: part (b) asks only for the sinusoids at $F_1$ and $F_2$, and Figure 2 marks only those four bins, so $H_{notch}(z)$ above is fourth order. Part (e) then says the IIR filter should "again remove the d.c. component", which introduces the d.c. requirement for the first time. It is answered as printed: the d.c. notch is included in part (e). If the examiner intended d.c. to be caught in part (b) as well, simply append the factor $(1 - z^{-1})$ there, giving the fifth-order FIR $1 - 2.41421 z^{-1} + 3.41421 z^{-2} - 3.41421 z^{-3} + 2.41421 z^{-4} - z^{-5}$ — which is exactly the numerator $N(z)$ used in part (e), at a cost of one extra delay and one extra addition.

Question 2 — results
PartQuantityResult
(a)Interferer frequencies$F_1 = 6$ kHz ($k = 8$), $F_2 = 12$ kHz ($k = 16$)
(b)$H_{notch}(z)$$1 - \sqrt{2} z^{-1} + 2 z^{-2} - \sqrt{2} z^{-3} + z^{-4}$
(b)Zeros / poles$e^{\pm j\pi/4}, e^{\pm j\pi/2}$ on the UC; 4 poles at $z = 0$
(c)Multiplications1 (the $\sqrt{2}$ tap)
(c)Additions/subtractions3
(c)Storage4 delay registers + 1 coefficient
(d)Blocked at $F_s = 10$ kHz1.25 kHz and 2.5 kHz
(e)$H_{IIR}(z)$$N(z)/N(z/r)$ with $r = 0.95$
(e)Notch −3 dB width at $\pi/4$FIR 0.4145 rad ($\approx$ 3167 Hz) vs IIR 0.0999 rad ($\approx$ 763 Hz)