State Transition and System Responses

English translation

Control Engineering I · Week 6

This week's objective · Calculate and compare motion caused by the initial position and velocity separately from motion caused by external force.

Run: After signing in to MathWorks, open .mlx in your workspace. Click inside the code → Live Editor → Run Section to run one section at a time. Run runs everything. After changing a value, rerun the relevant section. Edit the text in ⟦enter here⟧ response fields; do not execute them. You can use Ctrl+Enter on Windows/Linux and ⌘+Enter on Mac.

From state equations to time responses

A state equation calculates the rate of change of the current state. In this exercise, plot how position and velocity change over time according to that equation. Choosing position and velocity as the states lets the state equation calculate how each value changes.

1. From the current state to the next state

Without an input, 𝐱(t)=Φ(t)𝐱(0)\mathbf x(t)=\Phi(t)\mathbf x(0). Φ(t)=eAt is the state transition matrix, which maps the initial state to the state after time t. In A=[01−2−3]A=\begin{bmatrix}0&1\\-2&-3\end{bmatrix}, take the two states as position and velocity and apply initial state [1;0].

From the current state to the next state

Use expm(A*t) to calculate eAt in MATLAB. At t=0, no time has elapsed, so the initial state must remain unchanged and Φ(0) is the identity matrix. The exercise code below checks whether expm(A*0) meets this condition.

The similarly named exp applies the exponential function to each matrix element separately. Applying exp to a 2×2 zero matrix therefore makes every element 1. This differs from the identity matrix that preserves the initial state, so it cannot replace expm in this exercise.

2. Two short time advances

For an LTI model, Φ(t1+t2)=Φ(t1)Φ(t2)\Phi(t_1+t_2)=\Phi(t_1)\Phi(t_2). First predict whether two 0.5-second transitions equal one 1-second transition, then check the difference using norm.

Two short time advances

This relation assumes the same A is maintained. Check whether the numerical result is within tolerance rather than exactly 0. Here, use a norm difference of 1e−10 as the criterion.

3. An input adds a response component

The object's motion can be calculated in two parts. Use initial for motion caused by the initial position and velocity without external force. Use lsim for motion caused by external force when both initial position and velocity are 0. Adding both results at matching times must equal the result with both the initial position and velocity and the external force applied.

An input adds a response

𝐱(t)=Φ(t)𝐱(0)+∫0tΦ(t−τ)Bu(τ)dτ\mathbf x(t)=\Phi(t)\mathbf x(0)+\int_0^t\Phi(t-\tau)Bu(\tau)\,d\tau. In this exercise, compare lsim(sys,u,t,𝐱0\mathbf x_0) with initial(sys,𝐱0\mathbf x_0,t)+lsim(sys,u,t,zeros(2,1)). Use the same t and output definition.

4. Label graphs with calculation conditions

Position and velocity have different units, so display them in separate subplots. State curves and output curves may differ. With C=[1,0]C=[1,0], only position is the output; inspect velocity in the state calculation.

Label graphs with calculation conditions

First display variable lengths and the meaning of each column. Label the figure with the time axis, units, and initial conditions, and report the maximum absolute difference for verification beyond a visual impression of similarity.

Check your understanding

  1. What values should go into the code, and what does each row and column of the resulting array represent? If calculating physical quantities, have you also checked the units?
  2. Can you identify which parts to rerun when you change one condition?
  3. Do the results match your expectations? If they differ, can you explain why using the output values or plots?

Official MATLAB documentation · Control System Toolbox

Practice materials