C946 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C9 · Lesson 46 · Discretizing continuous systems

Turning a differential equation into a difference equation

Controllers are designed with Laplace transforms, but they run on microcontrollers that see the world one sample at a time. Simulators face the same problem in reverse: a circuit is a differential equation, and a computer can only step it. Every conversion from continuous to discrete time is an approximation of how the system behaves between samples, and the wrong one can make a perfectly stable system blow up.

  • The smooth curve is a first-order system's step response, 1−e−at, plotted against the sample index n, with t = nT.
  • The stems are two discrete versions. ZOH (zero-order hold) gives the exact values at every sample. Forward Euler, which steps along the slope, wanders off as aT grows.
  • Push aT past 1: Euler overshoots and rings. Past 2 it diverges, although the real system is perfectly stable.

Predict

A first-order plant with a = 50 s⁻¹ is simulated by forward Euler with a 50 ms step. What happens?

Name it

Pole mapping

Sampling a continuous mode est every T seconds gives (esT)n, so a continuous pole at s becomes a discrete pole at

z=esT

The left half-plane maps inside the unit circle. A pole at s=−σ±jω lands at radius e−σT and angle ±ωT.

Methods

MethodReplace s withKeeps
zero-order holdexact solution with the input held constant between samplesthe step response at the samples
forward Euler(z−1)/Tnothing exactly; unstable for large T
backward Euler(z−1)/(Tz)stability, always (it over-damps)
Tustin (bilinear)2T⋅z−1z+1stability and the frequency response's shape (lesson 42)

For H(s)=a/(s+a), the ZOH equivalent is

H(z)=1−e−aTz−e−aT,y[n]=e−aTy[n−1]+(1−e−aT)u[n−1]

For a state-space model x˙=Ax+Bu, the ZOH equivalent is Ad=eAT and Bd=A−1(eAT−I)B.

The hold costs phase

A controller that outputs a held value updates T seconds apart; on average its output is T/2 late. That half-sample delay adds a phase lag of ωT/2, which eats into the loop's phase margin. The usual rule is to sample at least 10 to 30 times faster than the closed loop's bandwidth.

Worked example

Discretize H(s)=1/(s+1) with a zero-order hold at T = 0.1 s.

Show the solution
  1. Discrete pole. e−aT=e−0.1=0.9048
  2. Transfer function. H(z)=0.0952/(z−0.9048)
  3. Recursion. y[n]=0.9048y[n−1]+0.0952u[n−1]
  4. Check. Its DC gain is 0.0952/(1 − 0.9048) = 1, as the original's is, and its step response matches 1−e−t exactly at every sample.

Answer H(z)=0.0952/(z−0.9048), or y[n]=0.9048y[n−1]+0.0952u[n−1].

Worked example

A plant with a = 50 s⁻¹ is simulated with forward Euler. What step size keeps it stable, and what keeps it accurate to a few percent?

Show the solution
  1. Stability. Stability needs aT < 2, so T < 40 ms.
  2. Accuracy. The Euler pole should be close to the true one. At aT = 0.1: 1−aT=0.9e−aT=0.905
  3. Step for accuracy. That difference compounds to a few percent in the time constant, so T ≈ 2 ms.
  4. Stable or right. Stable is a much weaker requirement than right.

Answer T < 40 ms keeps it stable, but it takes T ≈ 2 ms to be accurate to a few percent.

Worked example

A digital control loop crosses over at 100 Hz and samples at 2 kHz. How much phase does the hold cost at crossover?

Show the solution
  1. Hold delay. The hold's average delay is T/2=0.25ms
  2. Phase lag at crossover. 360°×100×0.00025=9°
  3. Effect on margin. A loop designed in continuous time with 45° of margin keeps only about 36°.
  4. Faster sampling. Sampling at 10 kHz would cut the loss to 1.8°.

Answer the hold costs 9° of phase at crossover.

Check

H(s)=10/(s+10) is discretized with a zero-order hold at T = 0.001 s.

(a)

Where is the discrete pole?

(b)

What is the coefficient on u[n − 1]?

Check

A plant pole is at s = −20, simulated by forward Euler.

(a)

What is the largest step that keeps it stable?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

(b)

What is the Euler pole with a 1 ms step?

Check

A continuous pole pair at −10±j10 is sampled every 0.01 s.

(a)

What radius do the discrete poles have?

(b)

At what angle?

Write units the way you normally would: 1.5 rad and 1500 mrad are the same answer.

Check

A loop crosses over at 100 Hz and samples at 1 kHz.

(a)

How much phase does the hold's half-sample delay cost at crossover?

(b)

How many samples per period of the crossover frequency is that?

Check

Apply forward Euler to y˙=−ay with step T, starting from y[n] = y.

Step 1

What is y[n + 1]?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Check

Which discretization reproduces a system's step response exactly at the sample instants?

Explain why

Why can forward Euler turn a stable system unstable, when zero-order hold never does?

Practice

Keep practicing

7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.