ssest function - identification toolbox
Show older comments
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!
1 Comment
Stuart McGarrity
on 26 Aug 2018
The demo link is now broken.
Answers (1)
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
Rajiv Singh
on 24 Sep 2012
For a univariate time series, the number of noise sources allowed by IDSS structure is 1 (number of noise sources = number of outputs). You cannot really have a 3-input, one-output noise model. If you are going to simulate noise (your x signal), then you could try a 3-input one-output model. In that case choose B to be a 2-by-3 matrix and D to be a 1-by-3 matrix. K should then be a 2-by-0 matrix (since you are pretending the noise to be measured inputs).
Alex
on 25 Sep 2012
Rajiv Singh
on 26 Sep 2012
Hi Alex,
Perhaps we should discuss what you are trying to achieve. You have a time series y that you want to model. A time series model usually takes the form y = G e, that is, a white noise filter. The job of G is then to predict the value of time series N steps into future given its own past measured history. It is not a "simulation" model - N can't be arbitrarily large. For this model, you should therefore evaluate its power for small horizon predictions. If you are using COMPARE function to generate the output, use Horizon = 1 or 2 for example.
You say that you need 3 sources of noise in your model. What are they? What is the underlying equation? Are you in some fashion working with a Kalman filter representation with distinct process and sensor noise sources? If so, IDSS cannot handle such forms directly. You will need to use IDGREY models (which, btw, would also let you prescribe arbitrary parameter constraints). In particular see this example:
Rajiv
Alex
on 26 Sep 2012
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?
Categories
Find more on Linear Model Identification in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!