
How to add drift to a state equation by ssm() (State space function)?
11 views (last 30 days)
Show older comments
''ssm creates a standard, linear, state-space model object with independent Gaussian state disturbances and observation innovations.'' However, I cannot create a state-space model in which the state equation has a drift. For example:
A = 1;
B = 1;
C = 1;
D = 1;
Mdl = ssm(A,B,C,D)
The codes will create the ssm model as: State equation: x1(t) = x1(t-1) + u1(t)
Observation equation: y1(t) = x1(t) + e1(t)
What should I do if I want to add a drift term to the state equation, like x1(t) = x1(t-1) + u1(t)+c, where c is a constant (drift)?
0 Comments
Answers (1)
Shantanu Dixit
on 25 Mar 2025
Edited: Shantanu Dixit
on 25 Mar 2025
Hi Wilson,
You can add a drift term 'c' in the state equation when using the 'ssm' function by augmenting the state vector. Since 'ssm' assumes a standard linear state-space model without an explicit drift term, introducing an additional state variable allows the drift to be incorporated naturally.
You can refer to an example script which adds drift to a 'ssm' model
A = [1, 1; 0, 1];
B = [1; 0];
C = [1, 0];
D = 1;
% Define initial state (x1 and drift c)
initial_x1 = 0;
c = 0.5;
Mean0 = [initial_x1; c]
Cov0 = [0.1, 0; 0, 0];
% Create the state-space model
Mdl = ssm(A, B, C, D, 'Mean0', Mean0, 'Cov0', Cov0);
This ensures that the state equation follows: 

Hope this helps!
0 Comments
See Also
Categories
Find more on Standard State-Space Model in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!