%% Explicitly Create State-Space Model Containing Known Parameter Values
% This example shows how to create a time-invariant, state-space model containing known parameter values using ssm.
% Define a state-space model containing two independent, AR(1) states with Gaussian disturbances that have standard deviations 0.1 and 0.3, respectively. Specify that the observation is the deterministic sum of the two states. Symbolically, the equation is
% \left[
% {\begin{array}{*{20}{c}}{{x_{t,1}}}\\{{x_{t,2}}}\end{array}} \right] =
% \left[ {\begin{array}{*{20}{c}}{0.5}&0\\0&{-0.2}\end{array}}
% \right]\left[ {\begin{array}{*{20}{c}}{{x_{t - 1,1}}}\\{{x_{t -
% 1,2}}}\end{array}} \right] + \left[
% {\begin{array}{*{20}{c}}0.1 & 0\\0 & 0.3\end{array}} \right]\left[
% {\begin{array}{*{20}{c}}{{u_{t,1}}}\\{{u_{t,2}}}\end{array}}
% \right]
% {y_t} = \left[ {\begin{array}{*{20}{c}}1&1\end{array}}
% \right]\left[
% {\begin{array}{*{20}{c}}{{x_{t,1}}}\\{{x_{t,2}}}\end{array}}
% \right].
% Specify the state-transition coefficient matrix.

A = [0.5 0; 0 -0.2];

%
% Specify the state-disturbance-loading coefficient matrix.

B = [0.1 0; 0 0.3];

%
% Specify the measurement-sensitivity coefficient matrix.

C = [1 1];

%
% Define the state-space model using ssm.

Mdl = ssm(A,B,C)

% Mdl is an ssm model containing unknown parameters. A detailed summary of Mdl prints to the Command Window. By default, the software sets the initial state means and covariance matrix using the stationary distributions.
% It is good practice to verify that the state and observations equations are correct. If the equations are not correct, then it might help to expand the state-space equation by hand.
% Simulate states or observations from Mdl using simulate, or forecast states or observations using forecast.
% Copyright 2012 The MathWorks, Inc.