Programming language

Reference Tracking and Optimal Control

English translation

Examine why reference error remains even with a stable controller, and compare tracking performance with control-input cost.

Before practice

01 Does a stable system necessarily track its reference exactly?

Description

Stability concerns responses to initial states and inputs, while steady-state reference error also depends on the gain along the input–output path.

02 What receives more emphasis when Q increases?

Description

Assign a higher cost to deviations of that state from its reference. Record output error and control input separately to examine the trade-off.

Practice

Preview practice notebookDownload practice notebookPreview practice mlx scriptDownload practice mlx script

1. Choosing reference gain for reference tracking

Starting conditions

A=[01−2−3]A=\begin{bmatrix}0&1\\-2&-3\end{bmatrix}, B=[01]B=\begin{bmatrix}0\\1\end{bmatrix}, C=[10]C=\begin{bmatrix}1&0\end{bmatrix}, K=[63]K=\begin{bmatrix}6&3\end{bmatrix}, r=1r=1, x(0)=0.

Procedure

  1. Use N=1N=1 and N=8N=8 in turn to calculate unit-step responses on the same time axis. Record the responses and steady-state outputs side by side.
  2. For 0=(A−BK)xss+BNr0=(A-BK)x_{ss}+BNr under r=1r=1, derive xssx_{ss} in terms of NN. Use yss=Cxssy_{ss}=Cx_{ss} to find NN satisfying yss=1y_{ss}=1, and show your calculations.
  3. Compare the directly calculated NN with the final values of both responses, and explain what the reference gain changed.

Results to retain

Items to record and points to check
N
Steady-state value
Closed-loop Pole

Points to check

  • Do the directly calculated steady-state outputs match the final values of each simulation?
  • Do closed-loop poles remain unchanged when N changes?

2. Trade-off between output error and input cost

Starting conditions

Q=diag⁡(q,1)Q=\operatorname{diag}(q,1), q∈{1,25}q\in\{1,25\}, and R=[1]R=\begin{bmatrix}1\end{bmatrix}. Use x(0)=[10]x(0)=\begin{bmatrix}1\\0\end{bmatrix}, r=0r=0.

Procedure

  1. Solve the CARE for each Q and calculate K=R−1B⊤PK=R^{-1}B^\top P.
  2. Plot position and control input on the same time axis.
  3. Compare the integral of squared position error and the integral of squared input separately.

Results to retain

Items to record and points to check
q
K
Position-error integral
Input cost

Points to check

  • Are both Q matrices positive definite, with R>0R>0?
  • Do all poles of A−BKA-BK have negative real parts?

3. Reference tracking with model error

Starting conditions

Design using nominal B, and change only the actual input gain to Bactual=gBB_{\mathrm{actual}}=gB and g∈{.8,1,1.2}g\in\{.8,1,1.2\}. Use K=[63]K=\begin{bmatrix}6&3\end{bmatrix}, N=8N=8, r=1r=1.

Procedure

  1. Find the poles and final step-response value for each actual model.
  2. Check whether N calculated from the nominal model also achieves the exact reference in every actual model.
  3. Distinguish the roles of reference-gain adjustment and integral-error feedback.

Results to retain

Items to record and points to check
Input gain
Pole
Final value
Tracking error

Points to check

  • Were both the feedback and reference terms multiplied by the actual B_actual?
  • Did you check stability before calculating final values?

Official examples and data