%% Specify Number of Periods and IRFs to Plot
% Plot the 10-period IRFs of only the measurement variables in a system.
% 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)

% Mdl is a fully specified ssm model object.
% Plot the two 10-period IRFs of y_{2,t}, and suppress the state variable IRFs.

irfplot(Mdl,'NumPeriods',10,'PlotY',2,'PlotX',[]);

% The top subplot is the IRF of y_{2,t} resulting from a shock to u_{1,t}, which is persistent because the shock filters through the random walk state x_{1,t}.
% The bottom subplot is the IRF of y_{2,t} resulting from a shock to u_{2,t}, which is transient and eventually diminishes as time elapses because the state x_{2,t} exhibits autoregressive behavior.
% Copyright 2020 The MathWorks, Inc.