Week 7 · Does Changing the Model Representation Preserve the Response?

English translation

Before practice

01 Represent the same system differently

The motion of the same object can be expressed in different units or coordinates. When can changing the representation help the calculation?

Description
  • Changing units or coordinates can rescale numerical values or simplify relations for calculation.
  • In this exercise, check whether changing state coordinates preserves the physical response.

02 What remains unchanged when the representation changes

Can different numbers and matrices represent the same system? What must remain the same to establish this?

Description
  • The same physical initial state and input must produce the same output.
  • For the new coordinates, change not only the model matrices but also the initial state and output relation.

Practice

1. Model conversion and coordinate transformation

The model is 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}, and D=0D=0.

  • Read the given model's A,B,C,DA,B,C,D and write the two state equations by hand.
  • Set the initial conditions to 0 and take the Laplace transform of both state equations. From the first equation, express X2(s)X_2(s) in terms of X1(s)X_1(s) and substitute it into the second equation to obtain X1(s)U(s)\frac{X_1(s)}{U(s)}. For C=[10]C=\begin{bmatrix}1&0\end{bmatrix}, use the relationship between Y(s)Y(s) and X1(s)X_1(s) to express the result as Y(s)U(s)\frac{Y(s)}{U(s)}. Then describe how the output equation changes for C=[01]C=\begin{bmatrix}0&1\end{bmatrix}.
  • Then compare with the tf result.

Use P=diag⁡(2,0.5)P=\operatorname{diag}(2,0.5) for the coordinate transformation and x0=[11]x_0=\begin{bmatrix}1\\1\end{bmatrix} for the initial state.

  1. Before running the matrix-transformation code, substitute x=Pzx=Pz and ẋ=Pż\dot x=P\dot z into ẋ=Ax+Bu\dot x=Ax+Bu, and multiply both sides by P−1P^{-1}. Find the matrices corresponding to Az,BzA_z,B_z in ż=Azz+Bzu\dot z=A_z z+B_z u.
  2. Into y=Cxy=Cx, also substitute x=Pzx=Pz and find y=Czzy=C_z z's CzC_z.
  3. For the initial state, use x0=Pz0x_0=Pz_0 to find z0z_0. Match the three matrices you derived to Az, Bz and Cz in the “3. Rescale the state coordinates” code in the practice Live Script, and the initial state to z0 in the “4. Correct an initial-value transformation error” code in the practice Live Script. Record hand and code calculations in two adjacent columns, then note whether corresponding entries agree in each matrix or vector.

2. Responses before and after transformation

  1. Keep A,B,D in the “2. Responses before and after transformation” code in the practice Live Script, change to C=[0 1], then rebuild sys and G=tf(sys).
  2. Calculate step(sys,t) and step(G,t) on the same time axis, and record the maximum absolute difference between their outputs. Determine whether it is less than 10−810^{-8}.
  3. Write the output equations y=Cxy=Cx and DC gains before and after the change side by side. Explain why changing the selected state changes the output and DC gain.

3. Rescale the state coordinates

  1. Change to P=diag([3 2]), recalculate Az,Bz,Cz using Az=P\(A*P), Bz=P\B, and Cz=C*P, and record the matrix.
  2. Calculate the step responses of the original and transformed models on the same time axis, and record the maximum absolute difference between their outputs. Determine whether it is less than 10−810^{-8}.
  3. Explain why the output stays the same despite different matrix elements, using the relationship between x=Pzx=Pz and the output equation.

4. Correct an initial-value transformation error

  1. Set the initial state to x0=[10]x_0=\begin{bmatrix}1\\0\end{bmatrix}, [01]\begin{bmatrix}0\\1\end{bmatrix}, and [21]\begin{bmatrix}2\\1\end{bmatrix} in turn. Keep the model, coordinate-transformation matrix and time vector used in “3. Rescale the state coordinates” above. After changing the initial state, rerun the “4. Correct an initial-value transformation error” code in the practice Live Script.
  2. At each x0x_0, find initial(sys,x0,t) for the original model and initial(transformed,P\x0,t) for the transformed model. Also calculate the output when x0 is used unchanged in the same transformed model.
  3. For each initial state, record two columns: the maximum absolute difference between the correctly transformed and original outputs, and that between the output using the unchanged initial value and the original output. Explain why these cases differ, relating your explanation to x0=Pz0x_0=Pz_0.

Submission and saving

Include code, actual outputs and plots, and your own interpretation. Submit through KLAS; check the semester schedule and latest announcements for the deadline.

Filename: Name_StudentID_Week7.mlx.

Restart the runtime, run all code from the top, then save.

Optional practice

Example: applying an incorrect coordinate transformation to the transformed input matrix

  1. Keep A,B,C,P,Az,Cz in the “3. Rescale the state coordinates” code in the practice Live Script unchanged. In a separate model, calculate the difference from the original model’s step output when Bz=P*B is used incorrectly.
  2. Record the maximum absolute difference at t=(0:0.01:10)'. Change only the definition of Bz to P\B, recalculate the same difference, and compare the two values.