---
title: Linear-phase FIR systems
heading: The four types of linear-phase FIR filter, their amplitude functions and forced zeros, zero quadruples, and which type suits which job
eyebrow: S7 · Lesson 16 · Linear-phase FIR systems
xp: 50
---

::: hook
A symmetric impulse response gives a filter that delays every frequency equally, the property lesson 12 showed matters for pulses and data. But symmetry comes in four flavors, odd or even length and symmetric or antisymmetric, and each one forces zeros onto the unit circle at particular places. One kind can't make a highpass filter at all; another can't pass DC. Knowing the four types before designing saves discovering, after an hour of optimization, that the requested filter was impossible with the chosen length.
:::

::: play
- Amplitude responses of the simplest filters of each type, all with a free coefficient b: Type I $[1, b, 1]$, Type II $[1, b, b, 1]$, Type III $[1, 0, -1]$ and Type IV $[1, b, -b, -1]$.
- Whatever b is, Type II is zero at ω = π, Type IV is zero at ω = 0, and Type III is zero at both.
- Only Type I is free at both ends, which is why it's the default for lowpass, highpass and bandstop designs.
:::
:::

```sim plot
view: graph
x: w = 0..3.1416
y: A = -6..8
slider: b = -3..3 = 1
plot: b + 2*cos(w) | samples: 400 | label: Type I [1, b, 1]
plot: 2*b*cos(w/2) + 2*cos(3*w/2) | samples: 400 | color: ch2 | label: Type II [1, b, b, 1]
plot: 2*sin(w) | samples: 400 | dashed | color: ch3 | label: Type III [1, 0, −1]
plot: 2*sin(3*w/2) + 2*b*sin(w/2) | samples: 400 | dashed | label: Type IV [1, b, −b, −1]
```

::: predict
## A designer asks for a linear-phase highpass FIR filter with 32 taps and symmetric coefficients. What goes wrong?

- [ ] Nothing; 32 taps is plenty
- [x] It must have a zero at ω = π, exactly where a highpass needs full gain
- [ ] It can't have linear phase with an even length
- [ ] Its delay would be fractional, which is illegal

::: reveal
An even-length symmetric filter is Type II, and $H(-1) = \sum h[n](-1)^n$ pairs each coefficient with its mirror image of opposite sign, so it's exactly zero. A highpass needs gain at π. Use 31 or 33 taps (Type I) instead. Its half-sample delay, 15.5 samples, is perfectly legal and useful in fractional-delay and interpolation filters.
:::
:::

::: nameit
## Four types

With N taps (order M = N − 1) and $H(e^{j\omega}) = A(\omega)e^{-j\omega M/2}e^{j\beta}$, A real:

| Type | Symmetry | Length | Forced zeros | Suits |
|---|---|---|---|---|
| I | $h[n] = h[M - n]$ | odd | none | any filter |
| II | $h[n] = h[M - n]$ | even | ω = π | lowpass, bandpass |
| III | $h[n] = -h[M - n]$ | odd | ω = 0 and π | Hilbert transformers, bandpass |
| IV | $h[n] = -h[M - n]$ | even | ω = 0 | differentiators, Hilbert, highpass |

Types III and IV add a constant 90° (β = π/2), which differentiators and Hilbert transformers need. All four have constant group delay M/2 samples.

## Zero locations

For real, linear-phase h[n], zeros come in groups: if c is a zero, so are $c^*$, $1/c$ and $1/c^*$. Zeros on the unit circle come in conjugate pairs, real zeros in reciprocal pairs, and zeros at ±1 alone. Types II to IV have their forced zeros at z = −1, ±1 and +1.

## Amplitude functions

Type I with $h = [a, b, a]$: $A(\omega) = b + 2a\cos\omega$. Type II with $[a, b, b, a]$: $2b\cos\frac{\omega}{2} + 2a\cos\frac{3\omega}{2}$. Type III with $[a, 0, -a]$: $2a\sin\omega$. Type IV with $[a, b, -b, -a]$: $2a\sin\frac{3\omega}{2} + 2b\sin\frac{\omega}{2}$.
:::

::: example
## Show that $h = [1, 2, 2, 1]$ can't pass high frequencies, and find its gain at DC and at ω = 2π/3.

::: solution
1. **At ω = π.**
   $$\begin{aligned} H(-1) &= 1 - 2 + 2 - 1 \\ &= 0 \end{aligned}$$
   This is the Type II forced zero, so high frequencies can't pass.
2. **At DC.** The gain is the sum of the taps, 6.
3. **At 2π/3.**
   $$\begin{aligned} A &= 2(2)\cos(\pi/3) + 2\cos\pi \\ &= 2 - 2 \\ &= 0 \end{aligned}$$
   a second null.
4. **Factor.** The coefficients factor as
   $$(1 + z^{-1})(1 + z^{-1} + z^{-2})$$
   with zeros at −1 and at $e^{\pm j2\pi/3}$.

**Answer:** the response is forced to zero at ω = π; the gain is 6 at DC and 0 at 2π/3.
:::
:::

::: example
## A linear-phase filter has a zero at $0.5e^{j\pi/4}$. What's the shortest real linear-phase filter with that zero?

::: solution
1. **The zeros it brings.** The zero brings its conjugate and reciprocals with it: $0.5e^{-j\pi/4}$, $2e^{j\pi/4}$ and $2e^{-j\pi/4}$.
2. **Multiply the factors.**
   $$\begin{aligned} &(1 - 0.7071z^{-1} + 0.25z^{-2}) \\ &\times (1 - 2.828z^{-1} + 4z^{-2}) \end{aligned}$$
   gives [1, −3.536, 6.25, −3.536, 1].
3. **Check its type.** The taps are symmetric: 5 taps, Type I, with group delay 2 samples.

**Answer:** h = [1, −3.536, 6.25, −3.536, 1], a 5-tap Type I filter with a group delay of 2 samples.
:::
:::

::: example
## A Type I filter has h = [−1, 2, 6, 2, −1]/8. Find its amplitude at 0, π/4, π/2 and π, and its delay.

::: solution
1. **Amplitude.**
   $$\begin{aligned} A(\omega) &= \frac{6}{8} + 2\cdot\frac{2}{8}\cos\omega \\ &\quad + 2\cdot\frac{-1}{8}\cos2\omega \\ &= 0.75 + 0.5\cos\omega \\ &\quad - 0.25\cos2\omega \end{aligned}$$
2. **Evaluate.** It's 1 at DC, 1.10 at π/4, 1 at π/2 and exactly 0 at π.
3. **Shape.** The negative end taps sharpen the response, peaking slightly above 1 before the null.
4. **Delay.**
   $$\frac{5 - 1}{2} = 2\ \text{samples}$$
   at every frequency.

**Answer:** the amplitude is 1 at DC, 1.10 at π/4, 1 at π/2 and 0 at π, and the delay is 2 samples.
:::
:::

::: check
given: a = 0.5 | 1 | -0.4; b = 1 | 2 | 0.6; w = 0.5 | 1.6 | 2.6
answer: b + 2*a*cos(w)
tolerance: 0.5%

## A Type I filter $[\given{a}, \given{b}, \given{a}]$. What's its amplitude A(ω) at ω = {w}?

::: right
Right. $b + 2a\cos\omega$ = {answer}.
:::

::: misses
- [b + a*cos(w)] Both outer taps contribute: $2a\cos\omega$.
- [any] Not yet. Factor out $e^{-j\omega}$ and pair the outer taps.
:::
:::

::: check
given: a = 0.5 | 1 | 2; b = 1 | 3; w = 0.4 | 1.2 | 2.5
answer: 2*b*cos(w/2) + 2*a*cos(3*w/2)
tolerance: 0.5%

## A Type II filter $[\given{a}, \given{b}, \given{b}, \given{a}]$. What's A(ω) at ω = {w}?

::: right
Right. $2b\cos\frac{\omega}{2} + 2a\cos\frac{3\omega}{2}$ = {answer}.
:::

::: misses
- [2*b*cos(w) + 2*a*cos(3*w)] The delay is 1.5 samples: the taps sit half-integers from the center.
- [any] Not yet. Factor out $e^{-j1.5\omega}$.
:::
:::

::: check
given: a = 0.5 | 1 | 2; w = 0.3 | 1 | 2
answer: 2*a*sin(w)
tolerance: 0.5%

## A Type III filter $[\given{a}, 0, -\given{a}]$. What's |A(ω)| at ω = {w}?

::: right
Right. $2a\sin\omega$ = {answer}: zero at both 0 and π, a crude bandpass or differentiator.
:::

::: misses
- [2*a*cos(w)] Antisymmetric pairs give sines, not cosines.
- [any] Not yet. $a(e^{j\omega} - e^{-j\omega})$ about the center.
:::
:::

::: check
given: a = 1 | 0.5; b = 2 | 3 | -1; w = 0.5 | 1.5 | 2.8
answer: 2*a*sin(3*w/2) + 2*b*sin(w/2)
tolerance: 0.5%

## A Type IV filter $[\given{a}, \given{b}, -\given{b}, -\given{a}]$. What's A(ω) at ω = {w}?

::: right
Right. $2a\sin\frac{3\omega}{2} + 2b\sin\frac{\omega}{2}$ = {answer}.
:::

::: misses
- [any] Not yet. Pair taps about the center 1.5 samples in.
:::
:::

::: check
given: r = 0.4 | 0.6 | 0.8; t = 20 | 45 | 70
answer: r^2 + 1/r^2 + 4*cos(t*pi/180)^2
tolerance: 0.5%

## A linear-phase filter's zero at {r}e^{j{t}°} forces three more zeros. In the resulting 5-tap filter [1, ·, c₂, ·, 1], what's the center coefficient c₂?

::: right
Right. $r^2 + 1/r^2 + 4\cos^2\theta$ = {answer}.
:::

::: misses
- [r^2 + 1/r^2] Include the cross term from the two $-2\cos\theta$ coefficients.
- [any] Not yet. Multiply $(1 - 2r\cos\theta\,z^{-1} + r^2z^{-2})(1 - \frac{2}{r}\cos\theta\,z^{-1} + \frac{1}{r^2}z^{-2})$.
:::
:::

::: check
given: a = 0.75 | 1 | 2; b = 1 | 3
answer: 2*a - b
tolerance: 0.5%

## What's the gain at ω = π of the Type I filter $[\given{a}, \given{b}, \given{b}, \given{b}, \given{a}]$ (with signs)?

::: right
Right. Alternating signs: a − b + b − b + a = {answer}.
:::

::: misses
- [2*a + 3*b] That's the DC gain; at π the signs alternate.
- [any] Not yet. Evaluate $\sum h[n](-1)^n$.
:::
:::

::: check
kind: parts
given: a = -1 | 1; b = 2 | 4; c = 6 | 10; w = 0.5 | 1.5 | 2.5

## 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$.
:::
:::

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

### What is A(π)?

::: misses
- [c + 2*b + 2*a] That's A(0).
- [any] Alternate the signs.
:::
:::
:::

::: check
kind: derivation
vars: a = -3..3, b = -3..3, c = -3..3, w = 0..3.14

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

::: step
answer: c + 2*b*cos(w) + 2*a*cos(2*w)

### What is its amplitude A(w)?
:::

::: step
answer: c + 2*b + 2*a

### What is A(0)?
:::

::: step
answer: 2

### What is its group delay, in samples?
:::

::: right
Right. A symmetric odd-length filter is a cosine series centered on its middle tap.
:::
:::

::: explain
## Why must a symmetric filter with an even number of taps have zero gain at the Nyquist frequency?

::: model
At ω = π the frequency response is $\sum h[n](-1)^n$: each coefficient is weighted alternately by +1 and −1. With an even number of taps arranged symmetrically, every coefficient h[n] has a mirror partner h[N − 1 − n] equal to it, and since N − 1 is odd, n and N − 1 − n always have opposite parity. So each pair contributes $h[n] - h[n] = 0$, and the whole sum vanishes, whatever the coefficients are. The zero at z = −1 is built into the structure, so no choice of coefficients can make such a filter pass high frequencies.
:::
:::

::: practice

::: check
given: a = 0.8 | -0.5; b = 1.5 | 2; w = 0.7 | 2.2
answer: b + 2*a*cos(w)
tolerance: 0.5%

## Type I [{a}, {b}, {a}]: A at ω = {w}?

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

::: check
given: a = 1 | 3; w = 0.6 | 1.8
answer: 2*a*sin(w)
tolerance: 0.5%

## Type III [{a}, 0, −{a}]: |A| at ω = {w}?

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

::: check
given: r = 0.5 | 0.7; t = 30 | 60
answer: r^2 + 1/r^2 + 4*cos(t*pi/180)^2
tolerance: 0.5%

## Center coefficient for a zero at {r}e^{j{t}°}?

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