How do I simulate simulink model using the ode45.m function at the command prompt or in an m file?

I need to run simulink model using the matlab function ode45.m, and I don't know how to do this as even with a simple first order system in simulink 1/(s+1) with sine input to it of Amplitude=1, and frequency set to 1 and it is saved as firstOrderSys.mdl . When I call this in an ode45 function: >>[t,x]=ode45(@firstOrderSys,[0 10],[0 0]) I get the following error message: >>Simulink model firstOrderSys was called with incorrect number of arguments
Many thanks!
Regards, Osman

Answers (1)

Osman, how about doing it all in Simulink?
If you select Simulation > Model Configuration Parameters in the Simulink model window you can select ode45 as the solver.

1 Comment

Hi Mischa, Thank you very much for the response. I am aware of this, but I want to be able to do it at the Matlab code level using the ode45 function. Any suggestions on how that could be done? Cam the ode45 take a mdl model as an input argument or it is not possible?
Thanks,

Sign in to comment.

Asked:

on 13 May 2014

Commented:

on 13 May 2014

Community Treasure Hunt

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

Start Hunting!