Model generated by system identification tool when transported into simulink, does not match and is unstable

1 view (last 30 days)
Hi Guys I encounter this problem while using Matlab 2011b. I have a single input single output system represented by test data which i import into the system id toolbox; the input is a step function. I am able to generate a 3rd order state space (SS) model called pss3. the 3rd order SS model is generated using the PEM method, Disturbance fixed at K=0 and initial state set to 0 and no covariance, all set in the Linear Parametric Model window of the sysid toolbox. The model shows a 94.29% match with the test data. The residual plot shows that the model's cross correlation b/w input & output residuals is well within 99% confidence intervals.
i transport pss3 into matlab workspace and from there into a state space model in simulink where i define the four state matrices as pss3.a ... p333.d. i use the commands data=iddata(test_output,test_input,ts) and x0=findstates(pss3,data) in a script file to generate initial condition x0 which is transported as the initial condition of the Simulink model. I excite the simulink model with the same step input as was used in the test to discover that the step response of the simulink model is not only way off (from the 3rd order SS model) but is also unstable. Am I making a mistake? How can this problem be fixed? Thanks

Answers (2)

Rajiv Singh
Rajiv Singh on 20 May 2013
Hi Saurabh, Could you try running the SIM command in the MATLAB Command Window (e.g. y = sim(pss3, input)) and check if the simulated response matches what you get in Simulink?
Also, could you send me an example that reproduces the problem you have described?
Rajiv

Saurabh Maithani
Saurabh Maithani on 21 May 2013
Hi Rajiv
Thanks for the response
I was able to produce a stable step response using the method you had suggested, i.e sim(pss3, input)). This did match the step response of the associated model in the sysid GUI. The 'sim' command was executed from the matlab command window and still does not match the response of the equivalent simulink model, which still displays an unstable system response.. So the problem still persists, as ultimately the goal is to use the mathematical model generated by the System ID tool in the matlab/simulink environment.
The 3rd order state space model predicted by system ID tool is as given below:
State-space model: x(t+Ts) = A x(t) + B u(t) + K e(t) y(t) = C x(t) + D u(t) + e(t) A = x1 x2 x3 x1 0.64061 -0.07739 0.073897 x2 -0.019825 0.97423 0.003614 x3 -0.27276 -0.065993 1.0074 B = u1 x1 -0.0068944 x2 -0.00044488 x3 -0.0062443 C = x1 x2 x3 y1 -14.116 -22.647 15.664 D = u1 y1 0 K = y1 x1 0 x2 0 x3 0 x(0) =
x1 -0.01272
x2 -0.020422
x3 0.014125
Loss function 0.0326025 and FPE 0.0359752 Sampling interval: 0.033
If you notice the eigen values of state matix A i.e. eig(pss3.a) yields 0.7031 0.9403 0.9789 which is an indication of unstable poles in the model generated by the sys ID tool.
I have even tried to convert the generated state space model into continous time(assuming it is a discrete time model which may be a wrong assumption) using d2c(pss3) and although the eigen values then do indicate stable poles, I am not able to match the test result with what this mode predicts.
Please let me know your thoughts about soliving this issue.
Again thatnks for the help.

Community Treasure Hunt

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

Start Hunting!