Digital control: sampling and z-transform
Sampled-data loops, the sampling theorem and aliasing, the zero-order hold, z-transform pairs and the s-to-z mapping, unit-circle stability, pulse transfer functions and controller discretisation.
Drafted with Aria, reviewed by the AiCanCode.org team. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Almost every modern mechatronic controller — a motor drive, a 3-D printer axis, a drone flight controller — is code running on a microcontroller. It sees the plant only at sampling instants and drives it through a DAC or PWM that holds each value until the next update. Sampling adds delay and can destabilise a loop that is perfectly stable in continuous time, so you need the z-transform to analyse, tune and implement digital loops properly.
Key ideas
The sampled-data loop. Sensor → anti-aliasing filter → ADC (sampler, period T) → algorithm (difference equation) → DAC with zero-order hold (ZOH) → plant. The controller works on sequences x[k] = x(kT); the plant still runs in continuous time.
Sampling theorem and aliasing. A signal band-limited to f_max can be reconstructed from samples taken at f_s > 2·f_max (the Nyquist rate). Components above f_s/2 (the Nyquist frequency) fold back and appear as false low frequencies — aliasing — which no later processing can remove; hence the analogue anti-aliasing filter before the ADC. For control, the theorem is only a minimum: a common rule is to sample 10–30 times faster than the closed-loop bandwidth, because the ZOH adds roughly T/2 of delay (phase lag ωT/2) that erodes phase margin.
Zero-order hold. Holds each sample constant for one period: transfer function G_h(s) = (1 − e^(−sT))/s. The combination ZOH + plant has the exact pulse transfer function G(z) = (1 − z⁻¹)·Z{G_p(s)/s}.
z-transform. For a sequence x[k], k ≥ 0: X(z) = Σ x[k]·z^(−k). It is the discrete counterpart of the Laplace transform, related by z = e^(sT). Key pairs: δ[k] → 1; unit step → z/(z − 1); aᵏ → z/(z − a) for |z| > |a|; sampled e^(−at) → z/(z − e^(−aT)). Key property: x[k − 1] → z⁻¹X(z) (a one-sample delay), which turns difference equations into algebra.
Mapping s to z (z = e^(sT)).
- The left half s-plane maps inside the unit circle; the jω-axis maps onto the unit circle; the right half-plane maps outside.
- s = 0 maps to z = 1; poles move toward z = 0 as they get faster (e^(−aT) → 0).
- Stability: all closed-loop poles strictly inside the unit circle |z| < 1. A pole on the circle is marginal; outside is unstable.
Analysis tools. Final value theorem: lim x[k] = lim(z→1) (z − 1)·X(z) (for stable sequences). Stability tests: Jury's test, or the bilinear (w-) transformation followed by Routh. For first-order loops, simply require |pole| < 1.
Discretising a controller. Options: backward Euler s ≈ (1 − z⁻¹)/T; forward Euler s ≈ (z − 1)/T (can turn stable poles unstable); Tustin (bilinear) s ≈ (2/T)·(z − 1)/(z + 1), which maps the whole left half-plane inside the unit circle so stability is preserved, but warps frequencies (pre-warp at a critical frequency if needed). The digital PID in the PID topic is a backward-Euler discretisation.
Practical issues. Computation delay (output applied one sample late), quantisation of ADC and DAC (resolution limits and limit cycles), integer overflow and wind-up all appear in real implementations.
Formulas
X(z) = Σₖ₌₀^∞ x[k]·z^(−k) — z-transform.
z = e^(sT) — s-to-z mapping; T: sampling period (s).
f_s > 2·f_max — sampling theorem; f in Hz, f_s = 1/T.
G_h(s) = (1 − e^(−sT))/s — zero-order hold.
G(z) = (1 − z⁻¹)·Z{G_p(s)/s} — ZOH + plant.
For G_p(s) = K/(s + a): G(z) = (K/a)·(1 − e^(−aT))/(z − e^(−aT)).
lim(k→∞) x[k] = lim(z→1) (z − 1)·X(z) — final value theorem.
s ≈ (2/T)·(z − 1)/(z + 1) — Tustin (bilinear) approximation.
Worked examples
Example 1 (standard — discretising a plant). The plant G_p(s) = 1/(s + 2) is driven through a ZOH with T = 0.1 s. Find G(z), the difference equation, the first three samples of the unit-step response and the final value.
- With K = 1, a = 2: e^(−aT) = e^(−0.2) = 0.8187.
G(z) = (1/2)(1 − 0.8187)/(z − 0.8187)= 0.0906/(z − 0.8187).- Difference equation: y[k + 1] = 0.8187·y[k] + 0.0906·u[k].
- With y[0] = 0 and u[k] = 1: y[1] = 0.0906, y[2] = 0.8187 × 0.0906 + 0.0906 = 0.1648, y[3] = 0.2256.
- Final value: G(1) × 1 = 0.0906/(1 − 0.8187) = 0.500 — equal to the continuous DC gain 1/2, as it must be.
- The pole z = 0.8187 is inside the unit circle: stable, and it equals e^(−2 × 0.1), the image of s = −2.
Example 2 (GATE level — sampling limits the gain). A digital proportional controller of gain K, a ZOH with T = 0.1 s and the plant 1/(s + 1) form a unity-feedback loop. Find the range of K for stability. Compare with the continuous loop.
- ZOH + plant: e^(−0.1) = 0.9048, so
G(z) = 0.0952/(z − 0.9048). - Closed-loop characteristic equation 1 + K·G(z) = 0 → z − 0.9048 + 0.0952K = 0.
- Closed-loop pole: z = 0.9048 − 0.0952K.
- Stability: −1 < 0.9048 − 0.0952K < 1.
- Upper limit (pole reaches −1): 0.0952K < 1.9048 → K < 20.0. Lower limit gives K > −1.0.
- For K > 0: stable for 0 < K < 20.0. (Exactly K < (1 + e^(−T))/(1 − e^(−T)) = 20.02.)
- The continuous loop K/(s + 1 + K) is stable for every K > 0. Sampling and the hold introduced delay, which created a finite gain limit — and it shrinks as T grows.
Common mistakes
- Using the left-half-plane test on z-plane poles. In z, stability means |z| < 1, not Re(z) < 0.
- Forgetting the ZOH and taking Z{G_p(s)} directly for a plant driven by a DAC.
- Sampling at just above twice the bandwidth and expecting good control; aim for 10–30 times.
- Applying the final value theorem with z → 0 instead of z → 1.
- Assuming a design that is stable in continuous time stays stable after discretisation by forward Euler.
- Confusing f in Hz with ω in rad/s in the sampling theorem.
For GATE ME
Expect: minimum sampling frequency or maximum sampling period for a given signal; z-transforms of simple sequences and evaluating X(z) at a point; pulse transfer function of ZOH + first-order plant; pole location and stability in the z-plane; range of gain for a first-order sampled loop; and final value of a sequence. Practise e^(−aT) evaluations and the s-to-z mapping rules.
Quick check
- A signal's highest component is 500 Hz. What is the minimum sampling rate to avoid aliasing?
- What is the z-transform of δ[k]?
- For x[k] = {1, 2, 3, 4} (k = 0 to 3), what is X(2)?
- Where must the poles of a stable discrete system lie?
- A sampled loop's closed-loop pole is z = −1.2. Is it stable?
Answers: 1. More than 1000 Hz. 2. 1. 3. 1 + 1 + 0.75 + 0.5 = 3.25. 4. Strictly inside the unit circle. 5. No — |z| = 1.2 > 1.
Interview questions
All Control Systems interview questionsTry answering each one aloud before you open it.
1.What is the z-transform and why is it important in digital control systems?Concept
The z-transform is a mathematical tool used to analyze and design digital control systems. It converts discrete-time signals, which are sequences of numbers, into a complex frequency domain representation. This transformation simplifies the analysis of linear, time-invariant systems by converting difference equations into algebraic equations. The z-transform is important because it helps in understanding system stability, designing controllers, and analyzing system behavior in the frequency domain.
2.Explain the concept of sampling in digital control systems.Concept
Sampling is the process of converting a continuous-time signal into a discrete-time signal by taking measurements at regular intervals, known as the sampling period. This is essential in digital control systems because digital controllers can only process discrete data. The sampling rate must be chosen carefully to capture the essential characteristics of the signal without introducing aliasing, which can distort the signal representation.
3.How does the Nyquist-Shannon sampling theorem relate to digital control systems?Concept
The Nyquist-Shannon sampling theorem states that a continuous-time signal can be completely reconstructed from its samples if it is sampled at a rate greater than twice its highest frequency component, known as the Nyquist rate. In digital control systems, this theorem guides the selection of the sampling rate to ensure that the digital representation of the signal accurately reflects the original continuous-time signal, preventing aliasing and ensuring system stability and performance.
4.Why is the bilinear (Tustin) transform used in digital control systems?Application
Tustin's method replaces s by (2/T)(z − 1)/(z + 1) to turn a continuous controller into a difference equation. It maps the entire left half s-plane inside the unit circle, so a stable analogue design always gives a stable digital one, unlike forward Euler. The price is frequency warping: the whole jω-axis is squeezed onto the unit circle, so frequencies are distorted as they approach the Nyquist frequency; pre-warping makes the match exact at one chosen frequency, such as a notch or crossover frequency.
5.What happens if the sampling rate is too low in a digital control system?Application
If the sampling rate is too low, it can lead to aliasing, where higher frequency components of the signal are indistinguishably mapped to lower frequencies. This results in distortion and loss of information, making it impossible to accurately reconstruct the original continuous-time signal. In control systems, this can lead to incorrect system behavior, instability, and degraded performance.
6.Explain how zero-order hold (ZOH) is used in digital control systems.Concept
Zero-order hold (ZOH) is a method used to convert a discrete-time signal into a continuous-time signal by holding each sample value constant over the sampling period. In digital control systems, ZOH is used to interface digital controllers with continuous-time processes. It ensures that the output signal remains constant between sampling instants, providing a piecewise constant approximation of the desired control signal.
7.Why is it important to consider the effects of quantization in digital control systems?Application
Quantization is the process of mapping a large set of input values to a smaller set, such as rounding off continuous signal values to discrete levels. In digital control systems, quantization can introduce errors and noise, affecting system accuracy and performance. It is important to consider these effects to ensure that the digital controller operates effectively and that the system remains stable and performs as expected.
8.Calculate the z-transform of the discrete-time signal x[n] = (0.5)^n u[n], where u[n] is the unit step function.Numerical
The z-transform of x[n] = (0.5)^n u[n] is calculated as follows:
- X(z) = Σ (0.5)^n z^(-n) from n=0 to ∞.
- This is a geometric series with a common ratio of (0.5/z).
- The sum of the series is X(z) = 1 / (1 - 0.5z^(-1)), for |z| > 0.5.
9.Determine the sampling period required to avoid aliasing for a signal with a maximum frequency of 500 Hz.Numerical
The sampling theorem requires f_s > 2·f_max = 1000 Hz, so the sampling period must be shorter than T = 1/1000 s = 1 ms. Exactly 1 ms is the theoretical boundary, not a safe choice. In practice an anti-aliasing filter is added and, for a control loop, the sampling rate is chosen 10–30 times the closed-loop bandwidth, usually well above the Nyquist limit.
10.What is the effect of increasing the sampling rate on the performance of a digital control system?Application
Increasing the sampling rate generally improves the performance of a digital control system by providing a more accurate representation of the continuous-time signal. It reduces the risk of aliasing and allows for better tracking of rapid changes in the signal. However, it also increases the computational load on the digital controller and may require more bandwidth for data transmission. Therefore, a balance must be struck between performance improvement and resource constraints.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?