Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: ODE45 parameters error
Replies: 7   Last Post: Jun 19, 2013 2:51 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Titus Edelhofer

Posts: 1,639
Registered: 1/25/05
Re: ODE45 parameters error
Posted: Jan 17, 2005 3:40 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

this dummy parameter used to be a flag, which is not needed anymore.
If you call your function with handles instead of the name, you don't
need this dummy parameter, i.e.:
invert_pen(t,x,flag, c1,c2,c3)
-> ode45('invert_pen', ...)

-> ode45(@invert_pen, ...)

For the function handle to work (and similar for the string), the directory
containing the m-file needs to be on the path (or the same directory).

Hope this helps,


"Barjac" <barjac@hotpop.com> wrote in message news:6hobijxzg9uo@legacy...
> Hi Serdar,
> I've had exactly the same problem. I found out it seems like Matlab
> passes the empty options vector as the first additional parameter (and
> not, in your case, c(1)). I've managed to solve that by adding a
> 'dummy' unused parameter to my function. In your case, you'd have to
> define your function as invert_pen(t,x,dummy,c1,c2,c3), and just not
> use the dummy parameter.
> Hope this helps. Please tell me if you found another way to solve this
> problem.
> Cheers,
> Remi
> NB: I'm using Matlab 6.5 and my ode function is in a subdirectory of
> the directory from which I run my main program (dunno if this is of
> any importance, but it was a reason why I couldn't use a function
> handle - @myodefunction - instead of passing its name).
> --
> On Thu, 16 Dec 2004 16:18:31 -0500, Serdar wrote:

> >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...


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.