–––––|H|–1from scipy import signal2b = [1, 0, -1]3a = [1, -1.2728, 0.81]4z, p, k = signal.tf2zpk(b, a)5w, H = signal.freqz(b, a)1.001.00
-2-1012-101real partimag. partz-PLANEo zeros · × poles× r = 0.9 · dashed × r = 0.8poles 0.9 at ±45°0π/4π/23π/4π024681012ω (rad per sample) · π = 4000 Hz|H|GAIN |H(e^jω)|r = 0.9r = 0.8|H| = 1.55 at ω = π/2|H| = 0 at ω = 0|H| = 10.51 at ω = π/4peak 10.53 at ω = 0.79peaks 10.53 and 5.56freqz: 10.51 at π/4081624-2-1012n (sample number)h[n]IMPULSE RESPONSE h[n]8 samples×0.9 per sample
Coloured parts: what the current step is about; everything else rests in whiteBlocks: the tone dial, two zero sections (o), two pole sections (×), the gain block |H| and a Python code cardPlots: the z-plane with the point e^jω and its length arrows, the gain |H| against ω, and the impulse response h[n]The level token hops along the chain, picking up each length; the dial pointer turns by ωH(z) = (z − 1)(z + 1) / ((z − p)(z − p*)) with p = 0.9·e^(jπ/4): |H(e^jω)| is the product of the zero lengths over the product of the pole lengths to the point e^jω. The geometric rule gives |H| up to a constant gain factor; here the leading coefficients are both 1, so the factor is 1. The peak sits a little past the pole angle: the mirror pole alone would pull it slightly below π/4, but the zero at +1 pulls the low side down more (for this filter cos ω_peak = cos θ · 2r/(1 + r²)). That the peak is near, but not exactly at, the pole angle: J. O. Smith, Introduction to Digital Filters.

Zeros and poles

  1. This filter's transfer function is a fraction: H(z) = (1 − z⁻²) / (1 − 1.273z⁻¹ + 0.81z⁻²). A zero is a value of z that makes the top 0. A pole makes the bottom 0, so H blows up there.

Reading the gain off the plot

Shape: peak and ringing

In code

The working

# step 1/10 · factor

H(z) = (1 − z⁻²) / (1 − 1.273z⁻¹ + 0.81z⁻²)
     = (z² − 1) / (z² − 1.273z + 0.81)   (× z²/z²)
     = (z − 1)(z + 1) / ((z − p)(z − p*))

zeros: top = 0     z = +1, z = −1
poles: bottom = 0  z = p, p*
  p = 0.9·e^(jπ/4) = 0.636 + 0.636j
  p* = 0.636 − 0.636j  (its mirror)

built here as 4 sections in a row:
(1 − z⁻¹)(1 + z⁻¹) · 1/(1 − p z⁻¹) · 1/(1 − p* z⁻¹)

The filter is a chosen example: poles at radius 0.9 and angle π/4, zeros at +1 and −1, sampled 8000 times a second. Every length, gain and curve in the figure is computed from this model; the Python outputs come from running the code (scipy 1.13.1). The figure builds H(z) as four first-order sections. A single complex pole section needs complex arithmetic; the conjugate pair together has real coefficients, which is how it is built in practice (one second-order section).