File Exchange

image thumbnail

ODE4 gives more accurate results than ODE45, ODE23, ODE23s

version (423 KB) by John Keevil
Subroutine ode4 is more accurate than ode45, ode23 and ode23s for solving ODE.


Updated 08 Sep 2016

View License

The attached scripts solve the Two-Body Orbit Vector Ordinary Differential Equation using a MATLAB supported subroutine ode45, ode23 or ode23s and also using a simple unsupported subroutine ode4 (available in the attachment and elsewhere on File Exchange). All these subroutines use the Runge-Kutta algorithm for solving ODE's. The scripts compare the results with the exact analytic solution which is an appropriate ellipse: we can therefore compare the accuracies of the subroutines. We find that the supported subroutines show errors in the range of 0.1 to 0.5%; whereas ode4 shows a peak error of less than 10^-7% i.e. 10^6 times smaller.These results indicate that ode4 should probably be the first Runge-Kutta subroutine to try for solving ODE's. The attached information contains plots of these results and all the necessary scripts to duplicate the results.

Comments and Ratings (1)

ali raga



Added information to PDF file

Clarified the Description wording.

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Solving ODEs in MATLAB, Runge Kutta 4th order ode

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor