Sampling and digital control

On this page

Software reads measurements and changes actions at discrete instants; the plant continues evolving between them. We use the exact update from Dynamic models to separate sampling, hold, computation delay and numerical integration.

One sample, one held action

At , measure , calculate , and hold it until the next update: a zero-order hold. Initially assume no additional computation or transport delay. is the physical control period, not screen refresh time.

Sampling, computation and holdt = kTₛ: measure yₖCompute uₖ from current stateHold uₖ across the intervalPlant evolves continuouslyt = (k+1)Tₛ: new measurement

For , the exact held-input model is

The current action applies during to produce the next state. Do not use a future state to calculate the current action. This deviation model allows positive and negative actions without saturation.

Continuous stability need not survive sampling

Continuous feedback gives , stable for . Sampled feedback gives

The state evolves as , so asymptotic stability requires . For , , yielding

At 0.2 s, the multiplier is approximately 0.456: monotone decay. At 1 s it is −0.896: alternating decay. At 1.2 s it is −1.096: alternating growth. This is a genuine hold-and-sample effect, present even with exact plant integration.

Preparing the visual
Sampling and digital control · Experiment

Plant ẋ=−x+u, x0=1, K=2. Actions are held per period; intersample response is exact. Delayed mode starts with x−1=x0. Asymptotic stability requires spectral radius below 1. Vertical scale adapts to divergence.

Start at . Change the period and compare sample points with the continuous intersample response over the same 12 s window. Curves use the exact constant-input solution, not straight interpolation between samples.

A one-sample delay adds memory

If this period executes the previous action, , then

An old state or pending action must be stored. For , the delay-free pole is −0.180; delayed conjugate roots have magnitude . At , the delay-free pole is −0.652 but delayed roots have magnitude 1.049 and are unstable. Frequent measurements do not imply immediate actuation.

For discrete LTI systems, all closed-loop eigenvalues must lie strictly inside the unit circle. The map describes exact sampling of a continuous free mode. A sampled-feedback loop generally cannot be obtained by directly mapping continuous closed-loop poles because the action is held between samples.

Integration step is different

Euler integration of continuous gives . With numerical step , the multiplier −2 diverges even though the exact solution decays. This is a numerical artifact.

Keep control period and delays fixed while reducing integration step to check convergence. Exact zero-order-hold discretization removes this integration error for the stated linear plant; it does not remove measurement aliasing or computation delay.

Implement discrete PID consistently

For example, forward integration is . A held-measurement filter can use , . Specify whether current action uses old or updated states.

An anti-alias filter acts before sampling; smoothing afterward cannot recover already aliased information. Filtering also adds dynamics and phase cost. Choose periods using required bandwidth, computation/communication budgets and relevant plant modes, then test worst-case delays and jitter. No single sampling multiplier is universal.

Check your understanding

At , is multiplier −1 asymptotically stable?

Reasoning

No. The unforced state alternates without decaying. Strict stability requires magnitude below 1.

Should reducing browser frame rate change model poles or sample period?

Reasoning

No. Physical time and control events determine the simulation; rendering only displays it.

Further reading

python-control sample_system offers several discretization methods. Match the actual hold mechanism before designing the discrete loop.