This example shows how to create a time-invariant, state-space model containing known parameter values using
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
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
Mdl = ssm(A,B,C)
Mdl = State-space model type: <a href="matlab: doc ssm">ssm</a> State vector length: 2 Observation vector length: 1 State disturbance vector length: 2 Observation innovation vector length: 0 Sample size supported by model: Unlimited State variables: x1, x2,... State disturbances: u1, u2,... Observation series: y1, y2,... Observation innovations: e1, e2,... State equations: x1(t) = (0.50)x1(t-1) + (0.10)u1(t) x2(t) = -(0.20)x2(t-1) + (0.30)u2(t) Observation equation: y1(t) = x1(t) + x2(t) Initial state distribution: Initial state means x1 x2 0 0 Initial state covariance matrix x1 x2 x1 0.01 0 x2 0 0.09 State types x1 x2 Stationary Stationary
Mdl is an
ssm model containing unknown parameters. A detailed summary of
Mdl prints to the Command Window. By defualt, 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
simulate, or forecast states or observations using