---
title: "Problem set 4: structures, word length and IIR design"
heading: "Problem set 4: linear-phase types, filter structures and lattices, roundoff and scaling, impulse invariance and the bilinear transform"
eyebrow: S7 · Problem set 4
type: problems
---

::: hook
These problems cover lessons 16 to 19: the four linear-phase FIR types and their zeros, direct, cascade and lattice structures, coefficient quantization, roundoff noise, overflow scaling and limit cycles, and IIR design by impulse invariance and the bilinear transform.
:::

::: pool
pick: 12

::: check
kind: parts
given: a = 0.5 | 1.5; b = 1 | 2.5; w = 0.6 | 2.2

## Two short linear-phase filters: Type I [{a}, {b}, {a}] and Type II [{a}, {b}, {b}, {a}].

::: part
answer: b + 2*a*cos(w)
tolerance: 0.5%

### Type I amplitude at ω = {w}?

::: misses
- [any] $b + 2a\cos\omega$.
:::
:::

::: part
answer: 2*b*cos(w/2) + 2*a*cos(3*w/2)
tolerance: 0.5%

### Type II amplitude at ω = {w}?

::: misses
- [any] $2b\cos\frac{\omega}{2} + 2a\cos\frac{3\omega}{2}$.
:::
:::

::: part
answer: 2*a + b
tolerance: 0.5%

### Type I DC gain?

::: misses
- [any] Sum of the taps.
:::
:::
:::

::: check
kind: parts
given: r = 0.5 | 0.7; t = 25 | 60; s = 16 | 48

## A real linear-phase FIR filter has a zero at {r}e^{j{t}°} and no others except those it forces; it runs at {s} kHz.

::: part
answer: r^2 + 1/r^2 + 4*cos(t*pi/180)^2
tolerance: 0.5%

### Center coefficient of the 5-tap filter?

::: misses
- [any] $r^2 + 1/r^2 + 4\cos^2\theta$.
:::
:::

::: part
answer: -2*(r + 1/r)*cos(t*pi/180)
tolerance: 0.5%

### Second coefficient (the $z^{-1}$ term)?

::: misses
- [any] $-2r\cos\theta - \frac{2}{r}\cos\theta$.
:::
:::

::: part
answer: 2/s
unit: ms
tolerance: 0.5%

### Its delay?

::: misses
- [any] Two samples.
:::
:::
:::

::: check
kind: parts
given: M = 4 | 6 | 10; N = 6 | 8 | 12

## An IIR filter with M = {M} zeros and N = {N} poles.

::: part
answer: M + N + 1
tolerance: 0

### Multipliers in direct form?

::: misses
- [any] M + N + 1.
:::
:::

::: part
answer: M + N
tolerance: 0

### Delays in direct form I?

::: misses
- [any] M + N.
:::
:::

::: part
answer: (M + N + abs(M - N))/2
tolerance: 0

### Delays in direct form II?

::: misses
- [any] max(M, N).
:::
:::
:::

::: check
kind: parts
given: a = 0.4 | -0.9; k = 0.25 | -0.5; r = 0.9 | 0.95; B = 5 | 7

## A second-order all-pole denominator $1 + \given{a}z^{-1} + \given{k}z^{-2}$; and a biquad with pole radius {r} whose $r^2$ is rounded to {B} fractional bits.

::: part
answer: a/(1 + k)
tolerance: 0.5%

### Lattice $k_1$?

::: misses
- [any] $a_1/(1 + k_2)$.
:::
:::

::: part
answer: sqrt(round(r^2*2^B)/2^B)
tolerance: 0.0002

### Rounded biquad's pole radius?

::: misses
- [any] $\sqrt{q(r^2)}$.
:::
:::
:::

::: check
kind: parts
given: B = 11 | 15 | 23; a = 0.9 | 0.97 | -0.8

## A filter with a pole at {a} rounds once at its input to B = {B} fractional bits.

::: part
answer: 10*log(2^(-2*B)/12)
unit: dB
tolerance: 0.05

### Roundoff noise, dB re 1?

::: misses
- [any] $10\log(2^{-2B}/12)$.
:::
:::

::: part
answer: 10*log(2^(-2*B)/12/(1 - a^2))
unit: dB
tolerance: 0.05

### Output noise, dB re 1?

::: misses
- [any] Add the noise gain $1/(1 - a^2)$.
:::
:::

::: part
answer: 0.5/(1 - abs(a))
tolerance: 0.5%

### Dead-band limit, in LSBs?

::: misses
- [any] $0.5/(1 - |a|)$.
:::
:::
:::

::: check
kind: parts
given: r = 0.9 | 0.98; t = 0.3 | 1.2 | 2.6; a = 0.85 | 0.95

## A resonator with poles at {r}e^{±j{t}}; and a first-order filter with pole {a}.

::: part
answer: 10*log((1 + r^2)/((1 - r^2)*((1 + r^2)^2 - 4*r^2*cos(t)^2)))
unit: dB
tolerance: 0.05

### Resonator noise gain?

::: misses
- [any] The resonator noise-gain formula.
:::
:::

::: part
answer: 1 - a
tolerance: 0.5%

### L1 input scaling for the first-order filter?

::: misses
- [any] $1 - |a|$.
:::
:::
:::

::: check
kind: parts
given: w = 0.1 | 0.3 | 0.6; T = 1 | 2; W = 3 | 12

## The bilinear transform with T = {T}.

::: part
answer: 2/T*tan(w*pi/2)
tolerance: 0.5%

### Prewarped frequency of ω = {w}π?

::: misses
- [any] $\frac{2}{T}\tan(\omega/2)$.
:::
:::

::: part
answer: 2*atan(W*T/2)/pi
tolerance: 0.5%

### Digital frequency of Ω = {W} rad/s, in units of π?

::: misses
- [any] $2\arctan(\Omega T/2)/\pi$.
:::
:::
:::

::: check
kind: parts
given: a = 300 | 1500 | 6000; T = 0.05 | 0.2

## An analog pole at s = −{a} rad/s, sampled every {T} ms.

::: part
answer: exp(-a*T/1000)
tolerance: 0.5%

### Impulse-invariant pole?

::: misses
- [any] $e^{sT}$.
:::
:::

::: part
answer: (1 - a*T/2000)/(1 + a*T/2000)
tolerance: 0.5%

### Bilinear pole?

::: misses
- [any] $\frac{1 + sT/2}{1 - sT/2}$.
:::
:::
:::

::: check
kind: parts
given: p = 0.1 | 0.2; s = 0.35 | 0.5; A = 20 | 40

## A bilinear Butterworth lowpass: at most 1 dB to {p}π, at least {A} dB from {s}π.

::: part
answer: ceil(log((10^(A/10) - 1)/(10^0.1 - 1))/(2*log(tan(s*pi/2)/tan(p*pi/2))))
tolerance: 0

### Order?

::: misses
- [any] Prewarp, then the Butterworth formula, rounded up.
:::
:::

::: part
answer: 2*tan(s*pi/2)/(10^(A/10) - 1)^(1/(2*ceil(log((10^(A/10) - 1)/(10^0.1 - 1))/(2*log(tan(s*pi/2)/tan(p*pi/2))))))
tolerance: 0.5%

### Analog cutoff (T = 1) that meets the stopband exactly?

::: misses
- [any] $\Omega_s/(10^{A/10} - 1)^{1/2N}$.
:::
:::
:::

::: check
kind: parts
given: s = 0.6 | 0.7 | 0.85; f = 8 | 48

## Impulse invariance at {f} kHz: an analog response at {s}f_s.

::: part
answer: 1 - s
tolerance: 0.5%

### Where it appears, as a fraction of f_s?

::: misses
- [any] $(1 - s)f_s$.
:::
:::

::: part
answer: (1 - s)*f
unit: kHz
tolerance: 0.5%

### In kilohertz?

::: misses
- [any] Multiply by $f_s$.
:::
:::
:::

::: check
kind: parts
given: a = 1 | 0.5; b = 2 | -1; w = 0.4 | 1.9

## Type III [{a}, 0, −{a}] and Type IV [{a}, {b}, −{b}, −{a}].

::: part
answer: 2*a*sin(w)
tolerance: 0.5%

### Type III |A| at ω = {w}?

::: misses
- [any] $2a\sin\omega$.
:::
:::

::: part
answer: 2*a*sin(3*w/2) + 2*b*sin(w/2)
tolerance: 0.5%

### Type IV A at ω = {w}?

::: misses
- [any] $2a\sin\frac{3\omega}{2} + 2b\sin\frac{\omega}{2}$.
:::
:::
:::

::: check
kind: parts
given: N = 7 | 9 | 13; B = 9 | 13

## An order-{N} IIR filter in biquads, coefficients rounded to {B} fractional bits.

::: part
answer: ceil(N/2 - 0.0001)
tolerance: 0

### Sections?

::: misses
- [any] ⌈N/2⌉.
:::
:::

::: part
answer: 2^(-B - 1)
tolerance: 0.5%

### Largest coefficient error?

::: misses
- [any] Half a step.
:::
:::
:::

::: check
kind: parts
given: a = -1 | 0.5; b = 1 | 3; c = 4 | 8; w = 0.4 | 2

## A Type I filter has taps [{a}, {b}, {c}, {b}, {a}].

::: part
answer: c + 2*b*cos(w) + 2*a*cos(2*w)
tolerance: 0.5%

### What is A(ω) at ω = {w}?

::: misses
- [any] $h[2] + 2h[1]\cos\omega + 2h[0]\cos2\omega$.
:::
:::
:::

::: check
kind: parts
given: N = 6 | 10 | 16

## An order-{N} IIR filter is built from direct-form II biquads.

::: part
answer: N/2
unit: sections
tolerance: 0

### How many sections?

::: misses
- [any] N/2.
:::
:::

::: part
answer: 5*N/2
unit: multipliers
tolerance: 0

### How many multipliers?

::: misses
- [any] Five per section.
:::
:::
:::

::: check
kind: parts
given: f = 0.5 | 2; s = 8 | 32

## A first-order analog lowpass with a {f} kHz corner is mapped by impulse invariance at {s} kHz.

::: part
answer: exp(-2*pi*f/s)
tolerance: 0.5%

### Where is the digital pole?

::: misses
- [any] $e^{-\omega_cT}$.
:::
:::

::: part
answer: 20*log(2*pi*f/s/(1 - exp(-2*pi*f/s)))
unit: dB
tolerance: 1%

### How far is its DC gain above the analog filter's?

::: misses
- [any] $20\log_{10}\frac{\omega_cT}{1 - e^{-\omega_cT}}$.
:::
:::
:::
:::
