Skip to content
Mathematical Methods

Z transform in depth: stability, z plane, ZOH, Euler and Tustin

Properties and theorems proved, three inversion methods, stability with poles in the unit circle, the map z equals e to the sT, discretisation with hold, Euler and Tustin with prewarping, Python example, tables.

This page goes deeper into the lesson on the Z transform, the tool used to design every system that runs on a processor: digital filters, controllers in microcontrollers, car ECUs. It proves the properties and the initial and final value theorems, works out the inverse transform with three methods, proves the stability criterion (poles inside the unit circle), explains how the map z = e^{sT} transforms the s plane into the z plane and compares the methods for going from a continuous system to a discrete one: zero-order hold, Euler and Tustin. At the end are the tables to remember and a Python example.

The properties, proved

Definition: X(z) = \sum_{n=0}^{\infty}x[n]z^{-n}, for sequences that are zero for n \lt  0.

  • Delay by k samples. \sum_n x[n - k]z^{-n}, with m = n - k, becomes z^{-k}\sum_m x[m]z^{-m} = z^{-k}X(z) (terms with m \lt  0 are zero).
  • Advance. \sum_n x[n + 1]z^{-n} = z\sum_{m \ge 1}x[m]z^{-m} = z\left(X(z) - x[0]\right). More generally \mathcal Z\{x[n + 2]\} = z^2X - z^2x[0] - zx[1]: initial conditions enter as in Laplace.
  • Scaling. \sum a^nx[n]z^{-n} = \sum x[n](z/a)^{-n} = X(z/a): multiplying by a^n moves the poles by a factor a.
  • Multiplication by n. Differentiating X with respect to z: X'(z) = \sum(-n)x[n]z^{-n-1}, so \mathcal Z\{n\,x[n]\} = -z\,X'(z). From \mathcal Z\{u[n]\} = \frac{z}{z - 1} one gets \mathcal Z\{n\} = \frac{z}{(z - 1)^2}.
  • Convolution. \sum_n\sum_k x[k]h[n - k]z^{-n} = \sum_k x[k]z^{-k}\sum_n h[n - k]z^{-(n - k)} = X(z)H(z).

Theorem (initial and final values). x[0] = \lim_{z\to\infty}X(z). If the poles of (z - 1)X(z) lie inside the unit circle, \lim_{n\to\infty}x[n] = \lim_{z\to 1}(z - 1)X(z).

Proof. The first: as z \to \infty all the terms x[n]z^{-n} with n \ge 1 tend to 0. The second: \mathcal Z\{x[n + 1] - x[n]\} = (z - 1)X(z) - zx[0]. As z \to 1 the left-hand side tends to \sum_{n=0}^{\infty}(x[n + 1] - x[n]) = \lim x[n] - x[0] (telescoping series), so \lim_{z\to 1}(z - 1)X = \lim x[n]. ∎

The inverse transform: three methods

1. Partial fractions of X(z)/z. Expand \frac{X(z)}{z} and multiply back by z, so each term is \frac{Az}{z - p} \leftrightarrow A\,p^n. For a double pole, \frac{Az}{(z - p)^2} \leftrightarrow A\,n\,p^{n-1}.

2. Long division. Divide the numerator by the denominator in powers of z^{-1}: the coefficients of the quotient are the samples. It does not give a closed formula, but it is exactly what the processor does when it runs the difference equation.

3. Residues. x[n] = \sum\text{Res}\left(X(z)z^{n-1}\right) at the poles of X(z)z^{n-1}: this is the inversion formula, an integral around a circle in the region of convergence (lessons on Cauchy’s formula and residues).

Stability, proved

A discrete system is stable (BIBO: bounded input, bounded output) if and only if its impulse response is summable, \sum|h[n]| \lt  \infty.

Theorem. A system with rational H(z) is stable if and only if all its poles have modulus less than 1.

Proof. With partial fractions, h[n] is a combination of terms n^kp^n, one for each pole p (k less than the multiplicity). If |p| \lt  1, \sum n^k|p|^n converges (ratio test: the ratio tends to |p| \lt  1), and the sum of finitely many convergent series converges. If instead a pole has |p| \ge 1, the corresponding term does not tend to zero (for |p| = 1 it has constant or growing modulus), so h[n] is not summable. Finally, if \sum|h| = S and |x| \le M, |y[n]| = \left|\sum h[k]x[n - k]\right| \le MS: bounded output. ∎

Responses of a positive and a negative real pole
On the left the pole at 0.8 produces a sequence that decays without changing sign; on the right the pole at minus 0.8 produces a sequence that alternates sign at every sample, decaying at the same rate.

A negative pole has no continuous counterpart: it produces an oscillation at the Nyquist frequency (one sample up, one down). Complex poles re^{\pm i\theta} produce r^n\cos(n\theta + \varphi): damping given by the modulus, frequency by the angle.

Response of a pair of complex poles
With poles of modulus 0.9 and angle pi over 5 the sequence oscillates with a period of 10 samples inside the envelope 0.9 to the n, dashed.

In practice, to check stability without computing the poles one uses the Jury criterion (Digital Control lesson), or the bilinear transformation z = \frac{1 + w}{1 - w}, which maps the unit circle onto the left half of the w plane, and then the Routh criterion.

From the s plane to the z plane

Sampling with period T, a continuous pole s_k becomes the discrete pole z_k = e^{s_kT} (the sampled term e^{s_kt} is \left(e^{s_kT}\right)^n). With s = \sigma + i\omega: |z| = e^{\sigma T} and \arg z = \omega T.

  • the left half-plane (\sigma \lt  0) goes inside the unit circle, the imaginary axis onto the circle;
  • a vertical line \sigma = \sigma_1 goes into a circle of radius e^{\sigma_1T}: constant settling time;
  • the map is not one-to-one: s and s + i\frac{2\pi}{T} go to the same z. The strip |\omega| \lt  \pi/T alone already covers the z plane, and frequencies outside that strip are confused with those inside: this is aliasing, seen from the complex plane.
The map z equals e to the s T
The horizontal strip of the left half-plane between minus pi over T and pi over T, in green, goes into the unit circle. A vertical line with abscissa sigma 1, in purple, goes into a circle of radius e to the sigma 1 times T.

Discretising: ZOH, Euler, Tustin

A controller designed in continuous time, C(s), must be turned into a C(z) to run on the processor. The main methods:

Zero-order hold (ZOH). It is the exact model of a continuous process G(s) driven by a D/A converter that holds its output constant between samples:

    \[ G(z) = (1 - z^{-1})\,\mathcal Z\left\{\frac{G(s)}{s}\right\} \]

Proof. The discrete impulse, after the hold, is a pulse of duration T: u(t) - u(t - T). Its output is the step response g_1(t) = \mathcal L^{-1}\{G(s)/s\} minus the same delayed by T. Sampled and transformed, it gives \mathcal Z\{g_1\} - z^{-1}\mathcal Z\{g_1\}. ∎

For G = \frac{a}{s + a}: \frac{G}{s} = \frac{1}{s} - \frac{1}{s + a}, so G(z) = (1 - z^{-1})\left(\frac{z}{z - 1} - \frac{z}{z - e^{-aT}}\right) = \frac{1 - e^{-aT}}{z - e^{-aT}}. The pole is exactly e^{-aT}.

The zero-order hold
The converter output stays constant between sampling instants, forming a staircase, while the continuous response, dashed, changes continuously; at the sampling points the two values coincide.

Forward Euler: s \approx \frac{z - 1}{T} (derivative approximated with the forward difference). Backward Euler: s \approx \frac{z - 1}{Tz}. Tustin (bilinear transformation, trapezoidal rule): s \approx \frac{2}{T}\cdot\frac{z - 1}{z + 1}.

Theorem. Tustin maps the left half-plane exactly into the unit circle: a stable continuous controller stays stable for every T. Forward Euler does not: a stable continuous pole becomes unstable if T is too large.

Proof. Tustin: z = \frac{1 + sT/2}{1 - sT/2}. With \text{Re}\,s \lt  0, the numerator is closer to the origin than the denominator (they are symmetric about the imaginary axis, and 1 + sT/2 lies on the left), so |z| \lt  1. Forward Euler: z = 1 + sT. The disc |z| \lt  1 corresponds in s to the disc |s + 1/T| \lt  1/T: only poles inside that disc stay stable. A real pole s = -a becomes 1 - aT, unstable for T \gt  2/a. ∎

Stability regions of forward and backward Euler
On the left forward Euler: only the continuous poles inside the green circle centred at minus 1 over T are stable, which is only part of the left half-plane. On the right backward Euler: the whole plane is stable except the red circle centred at 1 over T.

The price of Tustin: frequency warping. On the circle z = e^{i\omega_dT}, the substitution gives s = i\frac{2}{T}\tan\frac{\omega_dT}{2}: the digital angular frequency \omega_d corresponds to the analogue angular frequency \omega_a = \frac{2}{T}\tan\frac{\omega_dT}{2}. For small \omega_dT the two coincide; near Nyquist the tangent blows up. To make an important frequency coincide (for example the cut-off of a filter, or the crossover of a controller) one uses prewarping: the continuous design is done at the corrected frequency \omega_a.

Frequency warping of the Tustin transformation
The red curve links the digital angular frequency to the analogue one: at low frequencies it coincides with the dashed bisector, then it grows faster and faster up to infinity at the Nyquist frequency.

Frequency response of discrete systems

With z = e^{i\omega T}, H(e^{i\omega T}) is the frequency response, periodic with period \frac{2\pi}{T} and (for real coefficients) symmetric: it is enough to look at it between 0 and the Nyquist frequency \omega T = \pi. The two-sample moving average \frac{1 + z^{-1}}{2} has magnitude |\cos\frac{\omega T}{2}|, zero at Nyquist; the exponential filter \frac{1 - a}{1 - az^{-1}} with a = 0.9 is a much more selective low-pass, but with feedback (IIR).

Frequency response of two digital filters
The magnitude of the two-sample moving average, in blue, falls slowly to zero at the Nyquist frequency; that of the exponential filter with a equal to 0.9, in red, falls much faster.

A Python example

With the free python-control library (in MATLAB the functions have almost the same names: tf, c2d, step) a system is discretised and the methods are compared:

import control as ct

T = 0.1                                  # sampling period [s]
G = ct.tf([2], [1, 2])                   # G(s) = 2/(s + 2)
Gzoh = ct.sample_system(G, T, method='zoh')
Gtus = ct.sample_system(G, T, method='tustin')
print(Gzoh)                              # 0.1813 / (z - 0.8187)
print(Gtus)                              # (0.09091 z + 0.09091) / (z - 0.8182)
print(ct.poles(Gzoh))                    # [0.8187] = exp(-2*0.1)

The ZOH pole is exactly e^{-2\cdot 0.1} = 0.8187; the Tustin one, \frac{1 - 0.1}{1 + 0.1} = 0.8182, is very close because aT = 0.2 is small. In MATLAB: G = tf(2,[1 2]); Gz = c2d(G, 0.1, 'zoh').

Tables to remember

Transforms (sequences that are zero for n \lt  0)

x[n]X(z)
\delta[n]1
\delta[n - k]z^{-k}
u[n]\dfrac{z}{z - 1}
n\dfrac{z}{(z - 1)^2}
a^n\dfrac{z}{z - a}
n\,a^n\dfrac{az}{(z - a)^2}
\cos n\theta\dfrac{z(z - \cos\theta)}{z^2 - 2z\cos\theta + 1}
\sin n\theta\dfrac{z\sin\theta}{z^2 - 2z\cos\theta + 1}
r^n\cos n\theta\dfrac{z(z - r\cos\theta)}{z^2 - 2rz\cos\theta + r^2}
r^n\sin n\theta\dfrac{zr\sin\theta}{z^2 - 2rz\cos\theta + r^2}

Properties: x[n - k] \leftrightarrow z^{-k}X; x[n + 1] \leftrightarrow zX - zx[0]; a^nx[n] \leftrightarrow X(z/a); nx[n] \leftrightarrow -zX'(z); x * h \leftrightarrow XH; \sum_{k=0}^{n}x[k] \leftrightarrow \frac{z}{z - 1}X; initial value x[0] = \lim_{z\to\infty}X; final value \lim_{z\to 1}(z - 1)X.

Discretisations

MethodSubstitutionPreserves stabilityNotes
ZOHG(z) = (1 - z^{-1})\mathcal Z\{G(s)/s\}yes, exactmodel of the process with D/A
Forward Eulers = \frac{z - 1}{T}nosimple, needs small T
Backward Eulers = \frac{z - 1}{Tz}yesadds damping
Tustins = \frac{2}{T}\frac{z - 1}{z + 1}yeswarps frequencies, use prewarping
Pole-zero matchingz = e^{sT} for poles and zerosyesgain must be adjusted

Exercises with difference equations, filters, stability and discretisations are on the exercise page linked at the top.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x