State-space system identification using known states, inputs, outputs

5 views (last 30 days)
Hi,
I am using System Identification Toolbox to identify a linear state-space model using n4sid algorithm. My model is a MISO. The data is formatted in a data object with several input channels and 1 output channel sampled with uniform sampling interval. The application of such identified model to act as a virtual sensor to estimate a quantity that can not be really measured using only input-output relation.
yEstimated = sim(mystatespacemodel, input_vector, estimated_state_from_previous_step, simopt);
However, during deployment I have to provide a vector of initial conditions besides the known input vector for each time instance. The states that the toolbox estimated during the fitting procedure are however artificial states, therefore I don't know in advance how I should initialize my model during deployment. Using the estimated initial conditions from the toolbox did not improve the results when I used them as an initial condition during deployment.
The idea now is to split some of the inputs as known states that can be used instead of the artificial states that Matlab derived in the form:
nx = size(x, 2);
sys = n4sid(u,y,x,nx,'Ts',Ts); % here is an extra input "x" which indicates the known states
% that should be used instead of the artificial states
I hope the question is clear and there is a solution for such problem.
Thanks in advance!

Answers (2)

Star Strider
Star Strider on 21 Oct 2022
I generally use lsim rather than sim. Looking through the sim documentation for opt, the simOptions function has a way to specify the initial conditions in InitialCondition. (The lsim function has this as an argument option.)
  1 Comment
Omar Kamel
Omar Kamel on 23 Oct 2022
Edited: Omar Kamel on 23 Oct 2022
Hi Star Strider, thanks a lot for your reply. However, this is what I didn't mean. I don't know any initial conditions in advance. I only have the inputs so I am trying to find a way to split the inputs list
to and train the model using the known , where I already know the initial states of .

Sign in to comment.


Rajiv Singh
Rajiv Singh on 7 Nov 2022
Initial conditions are not a property of the model that you can estimate in advance. You really need to ask yourself regarding what you can assume regarding the system's state before the input is applied. As such, this must come from physical insight regarding the system's state.
Some common scenarios:
  • State of rest: you may be able to set initial states to zero
  • You have measurement history (I/O values) of the state that prevailed before the input was applied; this could be a steady-state at some operating condition. Consider using the data2state command to transform the past behavior history into an initial state vector.
  1 Comment
Omar Kamel
Omar Kamel on 8 Nov 2022
Thanks Rajiv for your answer.
Probably I did not explain my problem well.
My measurement history for training is I/O values, but in deployment I only have the input time series, therefore I can't use data2state command to estimate the initial state vector based on the history.
What I want to do is to construct my idss system using iddata(inputs, outputs, states), for example I identify an unknown dynamic mass-spring-damper system where I have access to the control inputs (e.g. excitation force), states (e.g. displacements of masses), and my outputs, which I don't have access to during deployment are the internal forces.
I hope the problem is more clear now.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by