Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Hire PC
Posts:
2
Registered:
12/11/04


Running Simulink model from m.files
Posted:
May 20, 2000 9:57 PM


Hi everyone,
Can somebody tell me what i am doing wrong? I have written an m.file that is supposed to run batches of simulink model simulations, adjusting varia. In the mfile, i have set the model parameters such that the final values of the state variables are saved as 'xFinal' at the end of each simulation (the mfile is supposed to execute 80). The mfile also assigns a unique name to the 'xFinal' at the end of each simulation, and the 80 xFinal vectors are called up by their identifiers and saved as a single matrix at the end of the script.
I am running into problems with the 'xFinal' variable name. When i attempt to call up 'xFinal' after simulating the model, Matlab consistently refuses to recognise that i commanded it to save the final values as ''xFinal'. Only if I manually (ie in the Simlink GUI) run the simulation (with 'xFinal' entered in the Simulation Parameters dialog box), will xFinal show up in the Matlab workspace. If i then invoke the mfile, it marches through all 80 simulations, spitting out identical values for xFinal  the original values from running it manually!! Matlab seems incapable of recognising the FinalStateName comand that i use to assign a name to the final value vector.
Has anyone had this problem? Help!
Here is a copy of what I have in the mfile for the first 2 iterations:
equil options = simset('FinalStateName','xFinal') set_param('equil/w','Value','1/60') sim('equil') a1=xFinal([2 3])
equil options = simset('FinalStateName','xFinal') set_param('equil/w','Value','1/6.31871E+01') sim('equil') a2=xFinal([2 3])
Many thanks for any help you can offer.
Paul R.



