%% Implicitly Create State-Space Model Containing Regression Component
%%
% This example shows how to implicitly create a state-space model that
% contains a regression component in the observation equation. The state
% model is an ARMA(1,1).
%%
% Write a function that specifies how the parameters in |params| map to the
% state-space model matrices, the initial state values, and the type of
% state. Specify the regression component by deflating the observations
% within the function. Symbolically, the model is:
%
% $$\begin{array}{l}
% \left[ {\begin{array}{*{20}{c}}
% {{x_{1,t}}}\\
% {{x_{2,t}}}
% \end{array}} \right] = \left[ {\begin{array}{*{20}{c}}
% {{\phi _1}}&{{\theta _1}}\\
% 0&0
% \end{array}} \right]\left[ {\begin{array}{*{20}{c}}
% {{x_{1,t - 1}}}\\
% {{x_{2,t - 1}}}
% \end{array}} \right] + \left[ {\begin{array}{*{20}{c}}
% {{\sigma _1}}\\
% 1
% \end{array}} \right]{u_{1t}}\\
% {y_t} - \beta {z_t} = a{x_{1,t}} + {\sigma _2}{\varepsilon _t}.
% \end{array}$$
%
% <include>regressionParamMap.m</include>
%%
% Save this code as a file named |regressionParamMap| on your MATLAB(R) path.
%%
% Create the state-space model by passing the function |regressionParamMap|
% as a function handle to |ssm|.

% Copyright 2015 The MathWorks, Inc.

Mdl = ssm(@(params)regressionParamMap(params,y,z));
%%
% |ssm| implicitly creates the state-space model. Usually, you
% cannot verify implicitly defined state-space models.  
%%
% Before creating the model, ensure that the data |y| and |z| exist in your
% workspace.