Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define the state-space matrices A, B, C, D.
Simulink
A = [1]; B = [0; 1]; C = [1 0]; D = 0;
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing matrix A with B or C matrices.
Using incorrect matrix dimensions.
✗ Incorrect
The matrix A defines the system dynamics. Here, A = [0 1; -2 -3] represents a second-order system.
2fill in blank
mediumComplete the code to create the state-space system using the ss() function.
Simulink
sys = ss([1], B, C, D);Attempts:
3 left
💡 Hint
Common Mistakes
Passing B or C as the first argument instead of A.
Swapping the order of matrices.
✗ Incorrect
The ss() function takes matrices A, B, C, D in order to create the state-space system. The first argument is A.
3fill in blank
hardFix the error in the code to simulate the system response to input u.
Simulink
[y, t, x] = lsim(sys, [1], t);Attempts:
3 left
💡 Hint
Common Mistakes
Passing the system object instead of input signal.
Using output y or state x as input.
✗ Incorrect
The lsim function simulates the system response to input u over time t. The input signal is u.
4fill in blank
hardFill both blanks to create a state-space system and simulate its step response.
Simulink
sys = ss([1], [2], C, D); step(sys);
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping B and C matrices.
Omitting matrix B.
✗ Incorrect
The ss() function requires matrices A and B as first two arguments to define the system before simulating the step response.
5fill in blank
hardFill all three blanks to create a state-space system, simulate its impulse response, and plot the output.
Simulink
sys = ss([1], [2], [3], D); impulse(sys); title('Impulse Response');
Attempts:
3 left
💡 Hint
Common Mistakes
Passing matrices in wrong order.
Forgetting to add title to the plot.
✗ Incorrect
The ss() function requires A, B, C matrices in order before D. Then impulse() simulates the impulse response and title() adds a plot title.
