help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave ode45 vs. Matlab ode45


From: Jeffrey
Subject: Re: Octave ode45 vs. Matlab ode45
Date: Fri, 14 Jun 2013 20:05:50 -0700 (PDT)

Thanks, Stephen. That is how I understand Octave's ode45 help (now). And
your understanding of Matlab is correct (well, I don't know how it does the
interpolation, but it does interpolate to find the value at the time slots).

Do I understand your last paragraph to imply that Octave's ode45 does not
have the ability to solve like Matlab's does? Is it not possible to set the
output time values and the tolerance?

Note that Octave's ode45 is saving so many time steps that *it runs
considerably slower* on a much more powerful machine than Matlab does
running on my tiny laptop.

Another possible workaround (for anyone who finds this thread) might be to
call Octave's ode45 repeatedly with incremental time spans, using the final
conditions of the each call as the initial conditions of the following
call. In that way, you can still set the tolerance level. Of course, the
repeated calls may create even more inefficiencies.


On Fri, Jun 14, 2013 at 9:59 PM, Stephen Montgomery-Smith [via Octave] <
address@hidden> wrote:

> On 06/14/2013 02:44 PM, Torsten wrote:
>
> > On 14.06.2013 21:22, Jeffrey wrote:
> >> I'm getting different results from Octave's ode45 than from Matlab's. I
> >> also need to vary ode45's tolerance level, but I'm getting the
> following
> >> messages:
> >>
> >> warning: Option "RelTol" will be ignored if fixed time stamps are given
> >> warning: Option "AbsTol" will be ignored if fixed time stamps are given
> >>
> >> What do these messages mean? How do I properly set the tolerance? The
> >> documentation I can find indicates that 'time stamps' have to do with
> the
> >> time stamps of my source files. So not related to ode solving.
> >>
> >> Here is how I set the tolerance:
> >> tol=1e-8;
> >> options=odeset('Stats','on');
> >> options=odeset(options,'AbsTol',tol);
> >> options=odeset(options,'RelTol',tol);
> >> [t,u1]=ode45(@(t,y) f(t,y,beta), t; [u0;v0], options);
> >>
> >
> > I guess "time stamps" means that you have a vector of time instances as
> > time parameter t instead of an interval ([t_begin, t_end]). In the
> > latter case, ode45 can chose the grid points in order to match the
> > tolerances. For a time vector, this grid is fixed.
> >
> > Torsten
>
> I agree with Torsten.  I think the documentation provided by "help
> ode45" is rather hard to understand.  But looking at the source code of
> ode45.m shows that you get the above warning messages if the input t
> contains more than 2 elements.
>
> If t contains only two elements, then ode45 solves the ode at time
> intervals set so that it can be sure that RelTol and AbsTol are
> satisfied by the solution.  Then it solves the ODE from time t(1) to t(2).
>
> If t contains more than two elements, then it uses those elements to
> determine the time intervals used by the time solver.
>
> I am told that Matlab ode45 works differently.  What it does is to solve
> the ODE the same way irrespective of the length of t, and then uses a
> spline to figure out the value of the function at all the time slots.
>
> If you want to get octave ode45 to do the same as matlab ode45, I
> suggest you run ode45 with [t(1) t(end)] for the time slot, and then put
> the output of ode45 into the spline command with the third input set to t.
>
> _______________________________________________
> Help-octave mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4654279&i=0>
> https://mailman.cae.wisc.edu/listinfo/help-octave
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://octave.1599824.n4.nabble.com/Octave-ode45-vs-Matlab-ode45-tp4654259p4654279.html
>  To start a new topic under Octave - General, email
> address@hidden
> To unsubscribe from Octave, click 
> here<http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1599824&code=amVmZmFzY2h3YXJ6QGdtYWlsLmNvbXwxNTk5ODI0fC02ODE1OTkz>
> .
> NAML<http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Octave-ode45-vs-Matlab-ode45-tp4654259p4654281.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]