Date: Jun 20, 2013 2:29 AM
Author: Torsten
Subject: Re: Can not pass variable to ode45

"Sandip" wrote in message <kpt6ra$4ao$1@newscl01ah.mathworks.com>...
> Hi:
> Please suggest a way... I have a command as below to solve the ode by ode45 and I need to pass three variables.
> [x,y]=ode45(@fnode,xspan,y0,c1,c2,c3);
>
> I have defined the function in .m file as
> function yprime = fnode(x,y,c1,c2,c3)
>
> However, I can not read in the c3 in the function (ode) file. c1 & c2 are coming alright.
>
> Please help.


But I already gave you the solution ...
Call ode45 as
[x,y]=ode45(@(x,y)fnode(x,y,c1,c2,c3),xspan,y0)
and define the function in an .m file as
function yprime = fnode(x,y,c1,c2,c3)

Best wishes
Torsten.