Date: Jun 19, 2013 2:51 AM
Author: Torsten
Subject: Re: ODE45 parameters error

"Sandip" wrote in message <kprgse$for$1@newscl01ah.mathworks.com>...

> Serdar <sernarrow@yahoo.com> wrote in message <eef64c1.-1@webx.raydaftYaTP>...
> > I have some problems with additional parameters. Code is something
> > like that:
> > ...
> > ...
> > ...
> > c=place(At,bt,p)
> > tspan=linspace(0.001,3,1000);
> > [t,x]=ode45('invert_pen',tspan,x0,[],c(1),c(2),c(3));
> >
> > When i run this script file i have seen the following error.
> >
> > -------------------------------------------
> > ??? Error using ==> invert_pen
> > Too many input arguments.
> >
> > Error in ==> funfun\private\odearguments at 110
> > f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
> >
> > Error in ==> ode45 at 173
> > [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ...
> >
> > Error in ==> invert_pen_ode at 39
> > [t,x]=ode45('invert_pen',tspan,x0,[],c(1),c(2),c(3));
> > ------------------------------------------
> >
> > how can i use these parameters in ode45.
> > Please help...


> I am having similar error.
>
> I have the ode45[@odefn, ...) [odefn function called by handle] with three extra parameters to pass as arguments.
> e.g.
> yy=ode45(@odefn,t,x,c1,c2,c3)
>
> inside odefn I get the values c1, c2 ; however, c3 is undefined. the value of c3 did not come in.
> I tried using a dummy parameter like flag as well, but that did not help in reading in the c3.
> Please suggest!


Try to call ODE45 as
yy=ode45(@(t,y)odefn(t,y,c1,c2,c3),t,x)

Best wishes
Torsten.