Problem with System Identification Toolbox and 'sim' command

16 views (last 30 days)
Hello everyone
I want to model a time -domain dynamic system (A: as input signal and B: as output signal) using System Identification Toolbox. I have used Nonlinear models in this toolbox and the obtained model has a good accuracy with about 95% fitness. I transferred the model to the workspace, just simulated it again with input data A and using sim command ( sim(model,A) ) but the output result was completely wrong.
Anyone can help me?
Thanks
  1 Comment
Mehdi
Mehdi on 16 Nov 2015
Dear Rajiv Singah,
As you have compared SEM and PEM for idnlgrey structure and concluded that there is no difference between them for idnlgrey. However, since PEM takes into account measured output data and SEM does not, It is not clear to me why they are the same?
Thanks

Sign in to comment.

Accepted Answer

Rajiv Singh
Rajiv Singh on 24 Oct 2012
Some questions and comments:
1. What kind of nonlinear model did you create? If it was a nonlinear ARX model (idnlarx), what estimation focus did you use? If you did not specify focus for nonlinear ARX model estimation, it defaults to "prediction" which estimates the parameters to minimize the 1-step head prediction error. Then, the 95% fit refers to the comparison of prediction results to the data. SIM cannot compute n-step ahead predicted response. For that, you will need to use the PREDICT command. Note that a good prediction model need not be a good simulation model. If you really want to create a model for best possible simulation results, use Focus = 'simulation' during estimation. In the GUI, this option would be available under "Algorithm Options" dialog.
If you are estimating a Hammerstein Wiener (idnlhw) or a nonlinear grey box (idnlgrey) model, then there is no difference between simulation and prediction models and you don't have to worry about setting the focus.
2. What initial conditions did you use for simulation? The results shown in the GUI are based on use of best (estimated) initial states that would maximize the fit tot data. The command that GUI uses is COMPARE which gives you several choices for handling initial conditions. When using SIM, the initial conditions that maximize the fit to data can be obtained using the FINDSTATES command (true for idnlhw and idnlgrey models).
For an idnalrx model, the initial conditions for computing the fit value are chosen such that they match the initial N samples exactly (N = sum of maximum delays in all regressors used by the model; see getDelayInfo, getreg). To reproduce those results, use sim(model, data, 'matching', data(1:N)). Here the first N samples of simulated response would necessarily match those of the data and the "true" simulation would begin from sample N+1 onwards.
  6 Comments
Rajiv Singh
Rajiv Singh on 5 Nov 2019
Yes, use MERGE command to combine multple data sets into one. Then use it for estimation (tfest etc) and analysis (sim, compare etc)
Jiangfu
Jiangfu on 16 Jul 2023
Dear Singh
I meet a problem about system identification. It is linear system. It is a OE mode. I used 'compared' function. The obtained model has a good accuracy with about 85% fitness. However, when I used 'sim' function,I found that the output result was completely wrong. The result of the calculation starts at 0,but the real result does not start at 0. Could you help me?
Thanks

Sign in to comment.

More Answers (1)

Mehdi
Mehdi on 16 Nov 2015
Dear Rajiv Singah,
As you have compared SEM and PEM for idnlgrey structure and concluded that there is no difference between them for idnlgrey. However, since PEM takes into account measured output data and SEM does not, It is not clear to me why they are the same?
Thanks

Community Treasure Hunt

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

Start Hunting!