%  Example 2.1.  Computes the MIMO impulse response.
clear
%  Define the state model.
A=[-1  2
    0 -3];
B=[1 0
   0 4];
C=[1  1
   1 -1];
D=zeros(2);
%  Define the sampling time and time interval.
t=0:.05:5;
%  Compute the impulse response from each input.
g1=impulse(A,B,C,D,1,t);
g2=impulse(A,B,C,D,2,t);
%  Plot the results.
set(0,'DefaultAxesFontName','times')
set(0,'DefaultAxesFontSize',12)
set(0,'DefaultTextFontName','times')
figure(1)
clf
subplot(221),plot(t,g1(:,1))
y=ylabel('{\itg}_{11}({\itt})');
set(y,'Units','Normalized')
xpos=-0.15;
set(y,'Position',[xpos 0.4861 0])
xlabel('Time (sec)')
grid
subplot(222),plot(t,g1(:,2))
y=ylabel('{\itg}_{12}({\itt})');
set(y,'Units','Normalized')
set(y,'Position',[xpos 0.4861 0])
xlabel('Time (sec)')
grid
subplot(223),plot(t,g2(:,1))
y=ylabel('{\itg}_{21}({\itt})');
set(y,'Units','Normalized')
set(y,'Position',[xpos 0.4861 0])
xlabel('Time (sec)')
grid
subplot(224),plot(t,g2(:,2))
y=ylabel('{\itg}_{22}({\itt})');
set(y,'Units','Normalized')
set(y,'Position',[xpos 0.4861 0])
xlabel('Time (sec)')
grid
