Programming language

State Feedback and Observer

English translation

Estimate velocity to control a system that measures only position, and compare estimated velocity and noise sensitivity.

Before practice

01 Can velocity be determined by measuring position?

Description

Position at a single instant is insufficient. Observability concerns whether velocity can be distinguished from a record of changing position under known dynamics.

02 What changes when observer poles move further left?

Description

Initial estimation error may decay faster, but estimator gain for measurement noise may also increase. Compare convergence and noise response together.

Practice

Preview practice notebookDownload practice notebookPreview practice mlx scriptDownload practice mlx script

1. Can measurements distinguish states?

Starting conditions

With position [m] and velocity [m/s] as states, use ẋ=Ax+Bu\dot x=Ax+Bu, y=Cxy=Cx. Use 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}.

Procedure

  1. Form the controllability matrix [B,AB] and observability matrix [C;CA], and find their ranks.
  2. Compare the case where B is a zero vector with the case C=[00]C=\begin{bmatrix}0&0\end{bmatrix}.
  3. Explain the distinction between an ineffective input and an unavailable measurement.

Results to retain

Items to record and points to check
Condition
Controllability rank
Observability rank
Design feasibility

Points to check

  • Are both ranks of the baseline model 2?
  • Did you avoid applying pole placement directly to a rank-deficient model?

2. Connecting state feedback and observer

Starting conditions

u=−Kx̂+8ru=-K\hat x+8r, r=1r=1. Control poles: −2,−4; observer poles: −8,−10. Use x(0)=[10]x(0)=\begin{bmatrix}1\\0\end{bmatrix}, x̂(0)=[00]\hat x(0)=\begin{bmatrix}0\\0\end{bmatrix}.

Procedure

  1. Calculate K and L, and compare the eigenvalues of A−BKA-BK and A−LCA-LC.
  2. Integrate actual and estimated states simultaneously, and plot position, velocity, and estimation errors over 0–4 s.
  3. Distinguish the reduction in estimation error from the output approaching its reference.

Results to retain

Items to record and points to check
K
L
Control poles
Observer Pole
Final error

Points to check

  • Do the eigenvalues of A−BKA-BK and A−LCA-LC, after substituting the calculated KK and LL, match the specified control and observer poles, respectively?
  • At t=4t=4 s, are the position and velocity estimation errors below 1e-6 m and 1e-6 m/s, respectively?

3. Is a faster observer always better?

Starting conditions

Add n(t)=0.02*sin(40*t) to the measurement. Compare observer poles (−8,−10) and (−20,−25), keeping controller K fixed.

Procedure

  1. Use both observer settings in the practice notebook's function, and compare the control input u on the same time axis.
  2. Calculate position-error RMS, velocity-error RMS, and control-input RMS separately after 1 s.
  3. Interpret initial estimation-error convergence separately from the response to measurement noise.

Results to retain

Items to record and points to check
Observer Pole
Position error RMS [m]
Velocity error RMS [m/s]
Input RMS [N]
Reason for your choice

Points to check

  • Are noise, initial conditions, and time steps the same for both settings?
  • Did you avoid conflating error and input in a single metric?

Official examples and data