ssest function - identification toolbox

6 views (last 30 days)
Alex
Alex on 20 Sep 2012
Commented: Benjamin Pommer on 2 Nov 2022
Hello!
I'm using ssest function to estimate a state-space model of one dimensional signal. When I use ssest(y,2) I get a state-space model. However, I'd like to specify some free parameters in this state-space form:
A = [1 0;0 1]; B = [0.5; 0.5]; C = [1 1]; D = [0.1];
I package this into a model object idss(A,B,C,D) and specify the free parameters to be estimated as in this demo http://www.mathworks.com/products/sysid/examples.html?file=/products/demos/shipping/ident/iddemo7.html, but when I use ssest an error appears saying that "the number of inputs and outputs of the model must match...". So I wrote the state-space model adding some white noise inputs and zero outputs in order to match the dimensions but I got a fit to estimation data of -891.8%
Can anyone give me some guidance about the form to write this state-space model in order to apply ssest function specifying free parameters?
Do I have to use state-space models with specific dimensions? It means that I can't use a state-space model as above although it's dimensionally correct?
Thanks in advance!

Answers (1)

Rajiv Singh
Rajiv Singh on 21 Sep 2012
Hi Alex,
Could you post some more details? When you originally created the model object (idss(A,B,C,D)), what were the sizes of the matrices? If you are fitting a model to a single signal, B must be nx-by-0, C must be 1-by-nx, and D must be 1-by-0 matrix. You probably would need a K matrix of size nx-by-1 defining the initial value of disturbance matrix K (could be NaNs if you do not have an initial guess), so you actually create idss(A,B,C,D,K). Note that when you fit a signal, it is treated as a time series (a process driven by white noise):
dx/dt = A x + Ke
y = Cx + e
This is conceptually similar to the single-input, single-output model, if you think of e(t) as input u (t). Then K (times square root of noise variance) represents the "B" matrix and D = 1 of the standard state-space form. In fact, you can use "noise2meas" command to convert the time series model into a more familiar input-output model.
Direct estimation: If you want to fit a state-space model directly (that is, no intermediate creation of a model), you can use the syntax ssest(y,2) just the way you originally tried. For more control over data properties, you should actually do:
% also specify sample time and start time
data iddata(y, [], Ts, 'tstart', 0);
model = ssest(data, 2);
iomodel = noise2meas(model);
If that did not work for you, you must post some reproduction steps so that I can investigate it more thoroughly.
  6 Comments
Alex
Alex on 26 Sep 2012
Hi Rajiv,
This is what I'm trying to achieve: I have a time series y that can be modeled in this way "there are not inputs"
x(k+1) = A x(k) + w
y(k) = C x(k+1) + e
where w and e are independent white-noise terms with covariance matrices R1 and R2, respectively. As you mentioned it seems to be like a kalman filter representation. There are also free and fixed parameters, so I apply constrains as explained above.
Following the example (with IDGREY) I implemented the model having y and one input white noise:
A = [par1 0;0 1];
B = [0 ; 0];
C = [1 1];
D = [0];
R1 = [par2 0; 0 par3];
R2 = aux
However KF does not converges. I will check if it works with a different state-space representation.
Thanks!
Benjamin Pommer
Benjamin Pommer on 2 Nov 2022
Do you know how one can label the outputs from the estimated model when you use the compare command?

Sign in to comment.

Categories

Find more on Linear Model Identification 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!