%% Step Response Plot of MIMO Systems
% Consider the following second-order state-space model:
% \begin{array}{l}
% \left[ {\begin{array}{*{20}{c}}
% {{{\dot x}_1}}\\
% {{{\dot x}_2}}
% \end{array}} \right] = \left[ {\begin{array}{*{20}{c}}
% { - 0.5572}&{ - 0.7814}\\
% {0.7814}&0
% \end{array}} \right]\left[ {\begin{array}{*{20}{c}}
% {{x_1}}\\
% {{x_2}}
% \end{array}} \right] + \left[ {\begin{array}{*{20}{c}}
% 1&{ - 1}\\
% 0&2
% \end{array}} \right]\left[ {\begin{array}{*{20}{c}}
% {{u_1}}\\
% {{u_2}}
% \end{array}} \right]\\
% y = \left[ {\begin{array}{*{20}{c}}
% {1.9691}&{6.4493}
% \end{array}} \right]\left[ {\begin{array}{*{20}{c}}
% {{x_1}}\\
% {{x_2}}
% \end{array}} \right]
% \end{array}

A = [-0.5572,-0.7814;0.7814,0];
B = [1,-1;0,2];
C = [1.9691,6.4493];
sys = ss(A,B,C,0);

% This model has two inputs and one output, so it has two channels: from the first input to the output, and from the second input to the output. Each channel has its own step response.
% When you use step, it computes the responses of all channels.

step(sys)

% The left plot shows the step response of the first input channel, and the right plot shows the step response of the second input channel. Whenever you use step to plot the responses of a MIMO model, it generates an array of plots representing all the I/O channels of the model.  For instance, create a random state-space model with five states, three inputs, and two outputs, and plot its step response.

sys = rss(5,2,3);
step(sys)

% In a MATLAB figure window, you can restrict the plot to a subset of channels by right-clicking on the plot and selecting I/O Selector.
%
% Copyright 2020 The MathWorks, Inc.