Does changing the model representation preserve the response?
English translation
Control Engineering I · Week 7
This week's goal · Verify state space, transfer functions, and state coordinate transformations through input–output responses.
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.
1. Check matrix dimensions before transforming
First check matrix dimensions in and . With 2 states, 1 input, and 1 output, A:2×2, B:2×1, C:1×2, D:1×1. Ax and Bu must each produce as many values as there are states, and Cx and Du as many as there are outputs, so that the respective terms can be added.
Check matrix dimensions before transforming
Even with the same A and B, observing position and observing velocity give different outputs. Check which state C selects. This model uses x=[position;velocity] and as the baseline.
2. Different representations of the same model
is the input–output relationship with all initial conditions equal to 0. Compare tf(ss(A,B,C,D)) with the state-space step response using the same time axis. Numerically check whether the output difference is small.
Different representations of the same model
Converting to a transfer function hides the names of internal states and initial-state information. Equal step responses do not imply identical internal information.
3. Changing coordinates changes the matrices
expresses the same state in differently scaled coordinates. Substituting it into gives . Multiplying both sides by P⁻¹ gives , hence . Substituting into the output equation gives , hence . Rescale the states using . In MATLAB, you can calculate with P\(A*P) instead of inv(P)*A*P.
Changing coordinates changes the matrices
P must be invertible to convert between the new and original coordinates in both directions. The initial state must also be changed to z0=P\x0 to represent the same motion.
4. Find errors by comparing responses before and after transformation
If the step responses match but the initial-state responses differ, first check the initial-value coordinates. Check the input, time axis, output, and initial values in order.
Find errors by comparing responses before and after transformation
Change one code line yourself to reproduce an error caused by omitting the initial-value transformation, then correct it. To represent the same motion after changing coordinates, change both the model matrices and the initial values.
Check your understanding
- 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?
- Can you identify which parts to rerun when you change one condition?
- Do the results match your expectations? If they differ, can you explain why using the output values or plots?
Practice materials
- Control_Engineering_1_Week07_StateSpaceThree.mlxPreview mlx script · Download mlx script