Problems in using "ode45" to replace Matalb's "ode113"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems in using "ode45" to replace Matalb's "ode113"

rimolar
I have found a Matlab script which solve for the motion of planets in our
solar system. It use the ODE113 function to solve the ODE systems.

(http://personalpages.manchester.ac.uk/staff/paul.connolly/teaching/practicals/solar_system.html)

I have tried running it in Octave and have to replace the "ode113" function
in line 184 of
solve_solar_system.m with "ode45".

[t,y]=ode113(@solar01,tsol.*365.25.*24.*3600,YINIT,options);

But the following error was displayed:

starting_stepsize: operator /: nonconformant arguments (op1 is 1x1, op2 is
1x60)
    starting_stepsize at line 72 column 8
    ode45 at line 192 column 25
    solve_solar_system at line 185 column 5
    run_solar_system at line 71 column 24

Are something missing in the command "ode45" arguments to make it work?




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Problems in using "ode45" to replace Matalb's "ode113"

Sebastian Schöps
rimolar wrote

> [t,y]=ode113(@solar01,tsol.*365.25.*24.*3600,YINIT,options);
>
> But the following error was displayed:
>
> starting_stepsize: operator /: nonconformant arguments (op1 is 1x1, op2 is
> 1x60)
>     starting_stepsize at line 72 column 8
>     ode45 at line 192 column 25
>     solve_solar_system at line 185 column 5
>     run_solar_system at line 71 column 24
>
> Are something missing in the command "ode45" arguments to make it work?

The vector "AbsTol" is defined in the code as a 1x60 matrix and octave
cannot handle this. Octave expects a 60x1 vector for the tolerances. This is
a bug and I would kindly ask you to report it at savannah [1] such that it
can be fixed.

However, you can mitigate your problem for now by transposing AbsTol in line
178, i.e.

options=odeset('RelTol',1e-6,'AbsTol',AbsTol','OutputFcn',@myplotfun);

should work.

Sebastian





[1] https://savannah.gnu.org/bugs/?group=octave



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Problems in using "ode45" to replace Matalb's "ode113"

rimolar
Thanks. The "transpose" operator fix the problem.

I am not sure whether the original script can work in Matlab or not (maybe
the author have made a typing error of missing the transpose operator).

I have to read through the document in Matlab and Octave to see if there is
really any difference in the syntax of ODE113 and ODE45 or not before
submitting the bug report.




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html