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?
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.
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?