simulation with ARX models

25 views (last 30 days)
Filippo
Filippo on 5 Dec 2013
Answered: Luis Freire on 1 Jun 2017
Hi, using the system identification tool, I've created a model SISO arx[400 400 1], I've exported this model in the workspace, and now I would like to simulate this model. I wrote in matlab command window something like: >>simulation=sim(arx4004001,[input]); The problem is that, plotting this simulation I expected something like what i can see in the model output from SID, but it is completely different. Maybe the sintax is wrong? can someone help me please?

Answers (2)

Arkadiy Turevskiy
Arkadiy Turevskiy on 9 Dec 2013
Not 100% clear what you mean, but my guess is that you want the result of what you are doing at command line to look like the "model output" plot in the GUI, and what you are getting is something different.
If that is the case, then most likely the issue is the initial conditions for the model. The GUI automatically estimates initial conditions from data and uses them in the plot.
When you use sim at the command line, the initial conditions are set to 0 by default.
This is explained here.
So to get the same plot for sim as in the GUI, you need to estimate and use initial conditions.
here is an example of what you could do:
load dryer2 % example data file shipping with System Identification Toolbox
dry = iddata(y2,u2,0.08); % create iddata object
arxmodel=arx(dry,[4 4 1]); %estimate arx441 model - use your own order as needed
x0=findstates(arxmodel,dry); % find initial condition
OPT = simOptions('InitialCondition',x0); % specify simulation option to use init.cond.
ssmodel=idss(arxmodel); % convert the model to idss to be able to specify initial condition
sim(ssmodel,dry,OPT) % simulate with initial condition
  2 Comments
Filippo
Filippo on 10 Dec 2013
Thank you Arkadiy, you exacly understand which was my problem.
I've tryed the solution you gave me, but it's not working, maybe because I'm using the MATLAB version r2007a.
When I try the function findstates, I get the error: ??? Undefined function or method 'findstates' for input arguments of type 'idpoly'.
I don't know if this is about my old version or licences.
Can you please help me again
Arkadiy Turevskiy
Arkadiy Turevskiy on 10 Dec 2013
In that case please contact technical support, maybe they can help.

Sign in to comment.


Luis Freire
Luis Freire on 1 Jun 2017
You can also try with the lsim function from the control toolbox, you will be able to simulate the response of a model given a bunch of imput parameters.

Community Treasure Hunt

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

Start Hunting!