HuntsvilleEngineers mark
HE Reference Shelf — huntsvilleengineers.com
The Reference Shelf · Applied Engineering Math

Discrete-time control design

Taking a control law that works on paper in continuous time and making it still work when a microcontroller runs it once every sample tick.

Also known as: digital control · sampled-data systems · direct digital design

The formula

The bridge between the analog s-domain and the digital z-domain is the bilinear (Tustin) substitution:

s = (2/T) · (z − 1)/(z + 1)

Reading: wherever your continuous transfer function C(s) has an s, plug this in. T is the sample period in seconds, z is the one-step-forward shift operator (z·x[k] = x[k+1]). What comes out is C(z), a recipe made of past inputs and past outputs.

The z-transform itself is the discrete cousin of the Laplace transform:

X(z) = Σ x[k] · z^(−k)   ,  k = 0, 1, 2, ...

Reading: z^(−1) is "delay by one sample." A digital filter is nothing but a weighted sum of delayed signals, and X(z) is the bookkeeping for that sum.

The stability boundary moves. In continuous time, poles must sit in the left half-plane (Re[s] < 0). After discretization, poles must sit inside the unit circle (|z| < 1):

s-plane left half   ↔   z-plane inside |z| = 1
jω axis (the boundary)   ↔   the unit circle itself

Reading: the imaginary axis wraps around into a circle. A pole on the boundary is marginally stable in both worlds; the map preserves that.

Tustin warps frequency. The analog frequency ω_a and the digital frequency ω_d are not equal — they are tangent-bent:

ω_a = (2/T) · tan(ω_d · T / 2)

Reading: at low frequency they agree, but as ω_d climbs toward the Nyquist rate the tangent blows up, squeezing the whole infinite analog frequency axis into the finite digital band 0 to π/T.

Where you meet it

  • The motor controller on the bench. Somebody hands you a PID loop tuned in MATLAB against a continuous plant model. It ships on a Cortex-M running a 1 kHz timer interrupt. The tuning that looked crisp in simulation now rings, and nobody touched the gains. The gains didn't change; the sample rate discretized them.

  • A vibration or servo test stand at Redstone. The shaker controller closes its loop in a real-time OS at a fixed rate. When the test article's resonance climbs near a quarter of the sample rate, the notch filter you designed in s lands on the wrong frequency in z because of Tustin warping, and the notch misses the mode it was built to kill.

  • The design review board. An engineer presents a lead-lag compensator with a beautiful continuous Bode plot and no mention of sample rate. The first question from the back of the room is "what's your loop rate, and did you re-check phase margin after discretization?" That question separates a design that survives from one that oscillates on hardware.

  • Porting legacy analog hardware to firmware. A twenty-year-old box built from op-amps and RC networks gets re-implemented in a DSP. Direct digital design means you convert each RC stage to a difference equation and run it as code — same transfer function, new substrate.

How it works

You have two honest paths. Emulation (also called design-then-discretize): design the whole controller in continuous time where your intuition lives — phase margin, gain crossover, root locus — then convert C(s) to C(z) at the end. Direct digital design: build the plant model in z from the start (with a zero-order hold on the input) and never leave the discrete world. Emulation is more common because the continuous tools are more familiar. Direct design is more honest at low sample rates, because it accounts for the sampling from the first line.

Tustin is the workhorse conversion because it does one thing no other simple method does: it maps every stable analog pole to a stable digital pole and every unstable one to unstable, with no exceptions. Forward Euler (s = (z−1)/T) can turn a stable analog system into an unstable digital one if T is too big — it pushes poles right out past the unit circle. Backward Euler is safe but distorts more. Tustin comes from the trapezoidal rule for numerical integration, and the trapezoid is why it behaves.

The price of Tustin is frequency warping. Run the numbers: sample a first-order lag 1/(1 + s) (corner at 1 rad/s) at T = 0.1 s. The difference equation that falls out is

y[k] = 0.90476·y[k−1] + 0.04762·(u[k] + u[k−1])

DC gain checks out at exactly 1.0, and the corner lands at 0.99917 rad/s instead of 1.0 — a 0.08% miss, harmless here. But push a notch to a tenth of the sample rate and the warp becomes several percent, enough to walk the notch off a sharp resonance. The fix is prewarping: pick the one frequency you care about most, solve ω_a = (2/T)·tan(ω_d·T/2) for the analog design frequency, and design there so that after warping it lands exactly where you wanted. You only get to nail one frequency; everything else still bends.

The mistake people make is treating sample rate as a free parameter to be picked last, or picking it right at the Nyquist limit "because the theorem says twice the bandwidth is enough." The Nyquist–Shannon theorem is about reconstructing a signal, not about closing a loop with adequate phase margin. A control loop needs far more headroom. The working range in the control literature is roughly 6 to 25 times the closed-loop bandwidth, and many practitioners run 20 to 40 times, because sampling injects delay and delay eats phase margin. Sample a loop with a 10 Hz closed-loop bandwidth and you want somewhere between 200 and 400 Hz, not 20 Hz.

Two more effects bite on real hardware. The zero-order hold — the DAC holding each output constant for a full sample period — is not free. It adds an average half-sample of delay and rolls off the gain, a 3.9224 dB loss right at the Nyquist frequency. And computational delay: the time between reading the sensor and writing the actuator is dead time in the loop. At high sample rates it is small; at low ones it is another pole's worth of phase you didn't budget for. The limit of validity on the whole emulation approach is exactly this: it assumes the sample rate is high enough that the discrete world looks almost continuous. When it isn't — when T is a real fraction of your dynamics — emulation lies and you must design directly in z.

History

Arnold Tustin (1899–1994) came up the hard way. He entered Armstrong College in 1916, served in the Royal Engineers in the First World War, and joined Metropolitan-Vickers as a graduate trainee in 1922 [1]. Through the late 1930s and the Second World War he worked on gun control — the Metadyne constant-current generator, gyroscopic stabilization, and servo-mechanisms for tanks and naval guns [1]. That war work is the crucible: aiming a gun is a control problem, and analyzing it with the tools of the day meant wrestling continuous differential equations by hand.

In 1947 Tustin published "A Method of Analysing the Behaviour of Linear Systems in Terms of Time Series" in the Journal of the Institution of Electrical Engineers, where he took the trapezoidal rule of numerical integration and turned it into the substitution that now carries his name [2]. That same year he was appointed Professor of Engineering and head of Electrical Engineering at the University of Birmingham, a post he held until 1955, after which he moved to Imperial College London through 1964 [1]. The transform predates cheap digital computers by a decade — Tustin was approximating continuous systems with difference equations because difference equations were something a human could iterate, not because a microcontroller was going to run them.

The other half of the foundation is the sampling theorem. Harry Nyquist established the sampling-rate condition in 1928, and Claude Shannon formalized it in 1949 [3]. Together they set the floor: below twice the bandwidth, information is lost and no amount of clever control recovers it. Tustin gave engineers the map between the two worlds; Nyquist and Shannon told them how fast the ticking has to be. When microprocessors arrived in the 1970s, both results were already sitting on the shelf, waiting.

Related tools

  • /tools/rc-filter
  • /tools/lc-resonance
  • /tools/frequency-period
  • /tools/vibration-natural-freq

Sources

  1. https://en.wikipedia.org/wiki/Arnold_Tustin
  2. https://en.wikipedia.org/wiki/Bilinear_transform
  3. https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
  4. https://en.wikipedia.org/wiki/Zero-order_hold
  5. https://en.wikipedia.org/wiki/Digital_control

Written by HE in our own words from the cited sources — engineering judgment included, your stamp still required. All entries →

★ The Reference Shelf

Reading is free. The shelf is for cardholders.

Your library card is an email address: pin it to your shelf, print the card, take the FE/PE quick-reference pack, read the Huntsville history. The shelf remembers what you reach for.

Already on the list? Enter with your subscribed email →