ode45 produces incorrect results
Ivan Sutoris
ivan.sutoris at gmail.com
Wed Apr 8 03:52:55 CDT 2009
On Wed, Apr 8, 2009 at 12:37 AM, Walter Hofmann
<octavebug at secretlab.mine.nu> wrote:
> To: bug at octave.org
> Subject: ode45 produces incorrect results
> --------
> Bug report for Octave 3.0.1 configured for x86_64-pc-linux-gnu
>
> Description:
> -----------
>
> f=@(t,u) ([u(2); -sin(u(1))+cos(t)/3]);
> t_range = [0; 40]; u_0 = [0; 0];
> [t_steps, u] = ode45(f, t_range, u_0);
> plot(t_steps, u);
>
> This should give the trajectory of a pendulum. Up to a point the graph
> looks good, but then it suddenly diverges. It should look like the
> graph here:
> http://mo.mathematik.uni-stuttgart.de/kurse/kurs4/seite50.html
The plot from the website is made with plot(u(:,1),u(:,2)). I can
confim the problem in 3.0.1 (octave + odepkg installed from Debian
Lenny repos), but I get correct result in 3.0.3 (in Windows with
bundled Octave-Forge packages) and also in compiled development
version (with odepkg installed through pkg command), so this has been
probably already fixed (although I don't know where the actual bug
was, in core Octave or in odepkg package).
Regards
Ivan Sutoris
More information about the Bug-octave
mailing list