Z-Transform
calculator.
Find the poles, zeros, stability and frequency response of a digital filter H(z).
- Poles
- 1
- Zeros
- 1
- Gain at DC
- 2
- Gain at Nyquist
- 0.6667
This is a low-pass filter: gain 2 at DC and 0.6667 at the Nyquist frequency. Every pole is inside the unit circle; once the largest one takes over, the impulse response shrinks by about 0.5 each sample.
Poles and zeros
Crosses are poles and rings are zeros; the dashed circle is |z| = 1. Poles: 0.5. Zeros: 0.
Gain from DC to Nyquist
Gain |H| from DC to the Nyquist frequency: 2 at DC, 0.6667 at Nyquist, largest 2 at 0π.
Working
- 1The difference equation these coefficients describey[n] − 0.5y[n − 1] = x[n]
- 2Take the z-transform: each delay of one sample becomes a factor z⁻¹H(z) =11 − 0.5z⁻¹
- 3The zeros are the roots of the top, the poles the roots of the bottom (in powers of z)Poles: 0.5Zeros: 0
- 4A causal filter is stable when every pole is inside the unit circlelargest |p| = 0.5 < 1, so stable
- 5The impulse response, one sample at a time: feed in 1 at n = 0h[0] =11= 1, h[1] =0 − (−0.5) × 11= 0.5
- 6Check: the bottom of H(z) is 0 at the largest pole|A(0.5)| = 0
First 16 samples of h[n]
| Sample n | h[n] |
|---|---|
| 0 | 1 |
| 1 | 0.5 |
| 2 | 0.25 |
| 3 | 0.125 |
| 4 | 0.0625 |
| 5 | 0.0313 |
| 6 | 0.0156 |
| 7 | 0.0078 |
Poles and zeros
| Root | Value | |z| | Angle (× π) |
|---|---|---|---|
| Pole | 0.5 | 0.5Angle (× π) 0 | 0 |
| Zero | 0 | 0Angle (× π) 0 | 0 |
How it's worked out
A linear digital filter computes each output sample y[n] from the current and past inputs x and its own past outputs. The coefficients b weight the inputs and a weight the outputs:
The z-transform turns a delay of one sample into a factor . Applied to both sides, the equation becomes a ratio of two polynomials, the transfer function H(z). You enter b and a in that order, starting with the power 0, the same order SciPy and MATLAB use.
The zeros are the values of z that make the top 0, and the poles are the values that make the bottom 0. The tool multiplies top and bottom by a power of z so both are ordinary polynomials, then finds every root, real or complex, by the Durand-Kerner iteration.
A causal filter is stable when every pole lies strictly inside the unit circle, where |z| < 1. Each pole p adds a term that behaves like p to the power n in the impulse response, so a pole of magnitude 0.5 halves that term every sample, and a pole of magnitude 1.2 makes it grow.
The frequency response is H on the unit circle, at , with ω from 0 (DC) to π (the Nyquist frequency, half the sampling rate). The gain is its size |H|. Poles near the circle lift the gain at their angle and zeros on the circle push it to 0.
Worked examples
A one-pole smoother
The filter y[n] = x[n] + 0.5y[n − 1] has b = 1 and a = 1, −0.5, so H(z) = 1 ÷ (1 − 0.5z⁻¹). The bottom is 0 at z = 0.5, one pole inside the unit circle, so the filter is stable.
Feed in a single 1 and the output is 1, 0.5, 0.25, 0.125, 0.0625 and so on, halving each time. The gain is 2 at DC and 0.6667 at Nyquist, so slow changes pass through and fast wiggles are damped: a gentle low-pass filter.
A resonance from complex poles
H(z) = 1 ÷ (1 − z⁻¹ + 0.5z⁻²) has a pair of poles at 0.5 + 0.5j and 0.5 − 0.5j. Their magnitude is 0.7071, inside the circle, so it is stable.
Complex poles make the impulse response swing: 1, 1, 0.5, 0, −0.25, −0.25, −0.125. The gain peaks at 2.8284 near 0.23π, higher than 2 at DC. Move the poles closer to the circle and the peak gets taller and narrower.
A four-point moving average
Averaging the last four inputs gives b = 0.25 four times and a = 1. There are no poles away from the origin, so the filter is stable and its impulse response is just 0.25, 0.25, 0.25, 0.25, 0: it ends after four samples. Filters like this are called FIR, finite impulse response.
The zeros sit on the unit circle at 0 + 1j, −1, 0 − 1j. The gain is 1 at DC but 0 at Nyquist and 0 at half of it, so the average wipes out a tone at those two frequencies completely.
Reading your result
The verdict comes from the largest pole. Under 1 means stable, so any bounded input gives a bounded output. A pole exactly on the circle is on the edge: the response never dies away. Above 1 the output grows without limit.
How close the largest pole is to the circle tells you how long the filter rings. With a pole at 0.5 the impulse response is down to 0.0078 after 8 samples. With a pole at 0.99 it is still 0.9321.
The shape sentence compares the gain at DC, at Nyquist and at any peak in between. It is a quick label, not a full filter specification; for cut-off frequencies and ripple, read the gain curve.
In the roots table the angle is in multiples of π. A pole or zero at angle θ affects the gain most near ω = θ, so a zero at 0.5π removes a tone at half the Nyquist frequency.
Common mistakes
- Entering coefficients in powers of z instead of z⁻¹. The tool reads b and a starting at the power 0 of z⁻¹, as SciPy’s lfilter and MATLAB’s filter do. A textbook written in positive powers of z needs its list read the other way round, padded so the lengths match.
- Forgetting the minus sign on feedback. y[n] = x[n] + 0.5y[n − 1] has a₁ = −0.5, not 0.5, because the output terms move to the left side. With +0.5 the pole moves to −0.5 and the filter becomes high-pass.
- Reading the gain of an unstable filter. 1 ÷ (1 − 1.2z⁻¹) has a pole at 1.2 and its impulse response grows: 1, 1.2, 1.44, 1.728, 2.0736. The curve can still be drawn, but no causal filter delivers it.
- Missing the poles at the origin. 1 ÷ (1 − 0.75z⁻¹ + 0.125z⁻²) has 2 zeros at z = 0 once written in powers of z. They do not change the gain, but they count toward the order.
- Rounding coefficients from a design tool. In a high-order filter, cutting coefficients to a few digits can move a pole from just inside the circle to just outside. Paste them at full length and use the decimal places control only for display.