%% Specify Number of Periods
% Explicitly create the multivariate diffuse state-space model
% \begin{array}{*{20}{l}}
% {{x_{1,t}}} = x_{1,t-1} + 0.2u_{1,t}\\
% {{x_{2,t}}} = x_{1,t-1}+0.3x_{2,t-1} + u_{2,t}\\
% {{y_{1,t}}} = x_{1,t}  +\varepsilon_{1,t}\\
% {{y_{2,t}}} = x_{1,t} + x_{2,t} +\varepsilon_{2,t}.\\
% \end{array}}

A = [1 0; 1 0.3];
B = [0.2 0; 0 1];
C = [1 0; 1 1];
D = eye(2);
Mdl = dssm(A,B,C,D,'StateType',[2 2])

% Mdl is an ssm model object.
% Compute the 10-period IRFs of the measurement variables.

ResponseY = irf(Mdl,'NumPeriods',10);

% ResponseY is a 10-by-2-by-2 array representing the 10-period IRFs of the measurement variables. For example, ResponseY(:,1,2) is the IRF of y_{2,t} as a result of a shock applied to u_{1,t}.

ResponseY(:,1,2)

% Copyright 2020 The MathWorks, Inc.