The same object responds differently when starting at rest and when already moving. How can this difference be reflected in the calculation?
Description
Specify the starting position and velocity as the initial state. Different initial states produce different responses even with the same subsequent input.
State transition describes how this initial state evolves over time.
02 Distinguish the causes of motion
How could separating the object's initial motion from the effect of subsequently applied force help you understand the response?
Description
Decompose a linear model into responses due to the initial state and the input
Calculate the total response by adding the input response with initial state 0
Practice
1. Calculate state transitions
Before running the general model below, calculate by hand the simple case with , , and .
For a diagonal matrix, .
Write and symbolically and check whether they equal their initial values at .
In the total-response equation, identify the term due to the initial state and the integral term due to the input. Explain which term is 0 here.
At , evaluate x(t) and leave its components in exponential form. Then assign the hand-calculation model to the separate variables A_check=diag([-1 -2]) and x0_check=[2;1], and compare the resulting state vector with expm(A_check)*x0_check.
Use this calculation as the baseline prediction for the “2. State Transition Matrix” code in the practice Live Script.
2. State Transition Matrix
Using the same A in the “2. State Transition Matrix” code in the practice Live Script, obtain Phi=expm(A*t) at and record the matrix.
Calculate norm(expm(A)-expm(A*0.5)*expm(A*0.5)) and record the residual. Check whether it is near 0 and compare with .
Relate your explanation to Phi-exp(A*0.5) calculated at the same , and explain why state transition uses expm instead of exp.
3. Compare state trajectories
Using the same A and time axis, change the initial state from [1;0] to [0;1] and recalculate X.
Plot the curves before and after the change for position X(1,:) and linear velocity X(2,:). Label the initial states in the legend.
Explain why position changes later despite an initial position of 0, relating this to the initial linear velocity.
4. Decompose the total response
Using sys,t defined in the total-response decomposition code, calculate each of the following cases.
Input u=2*ones(size(t)), baseline initial state x0=[1;0].
u=2*ones(size(t)) with input magnitude kept at 2, initial state x0=[0;1].
For each case, calculate the total output lsim(sys,u,t,x0), the output due to the initial state initial(sys,x0,t), and the output due to the input lsim(sys,u,t).
Record max(abs(yTotal-yInitial-yInput)) and explain the relation among the three outputs.
Compare the total output with only the input doubled against twice the baseline total output. Separately determine whether the output due to the initial state also doubles.
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_Week6.mlx.
Restart the runtime, run all code from the top, then save.
Optional practice
Example: Entering the initial state as a row vector
Using the same A in the “2. State Transition Matrix” code in the practice Live Script, test expm(A*0.5)*[1 0] on a separate line and record both matrices’ dimensions and the error message.
Change only the initial state to the column vector [1;0] and calculate. Write both components of the result and replace the incorrect input line with the corrected line.