Simple ODE Solver Suite
This is the Readme.txt file for the Simple ODE Solver Suite, version 1.16.2.
This group of six m-file ordinary differential equation (ODE) solvers
provides 3 fixed-step and 4 variable-step ODE solver methods.
There is an example dynamic system included (penddot.m) and a sample
driver script (pendulum.m) to solve the pendulum equations of motion
with all 7 solver options.
These solvers work in both Matlab and Octave.
There are 3 fixed-step Runge-Kutta algorithms and
3 variable step Runge-Kutta-Fehlberg algorithms along with
a Dormand-Prince 4(5) pair used by default in ode45.m.
All are explicit RK formulas that work well with nonstiff or mildly
stiff problems.
All contain their own documentation accessible at the command prompt
by typing 'help ode45' or 'help rk8fixed' or whichever solver you need help with.
Matlab and Octave both have built-in ode23 and ode45 solvers so make sure
you are careful about executing your scripts with these solvers in the
search path. Use `which ode45` to determine which is located first in the path.
Use `addpath('.')` if necessary but it should work from the `ode_solvers` directory.
----------------------------------------------------------------------
The archive ode_v1.16.tar.gz or zipfile contains these files:
- ode23.m : variable step, 2nd-3rd order
- ode45.m : variable step, 4th-5th order (both RKF and Dormand-Prince pairs)
- ode78.m : variable step, 7th-8th order
- rk2fixed.m : fixed step, 2nd order
- rk4fixed.m : fixed step, 4th order
- rk8fixed.m : fixed step, 8th order
- pendulum.m : a sample m-file script that runs all solvers
- penddot.m : derivative function file, returning dy/dt for a simple pendulum
- Readme.txt : this file
----------------------------------------------------------------------
Steps for testing these ode solvers:
(1) unzip the archive with:
unzip ode_solvers_v1.16.zip
or
tar xzvf ode_solvers_v1.16.tar.gz
(2) Start Matlab or Octave and change directories into the newly created directory
cd ode_solvers_v1.16
(3) run the sample pendulum.m driver script with:
pendulum
This script sequentially executes all 6 m-file integrators (with 7 solver methods)
and plots the output from all integrators.
----------------------------------------------------------------------
Basic differences between the integrators:
In general, the higher the integration order, the smaller the local truncation
error is at each time step. Small local truncation errors result in larger
integration steps. This is demonstrated by ode78 generating far fewer
steps than ode23 for solving the same problem over the same time interval with
the same error criterion.
The cost of the higher order integrators is the number of function evaluations
required at each step. This results in longer execution times for each integration
step however, if the higher order integrator takes much larger steps, the
total computational cost is less.
The tradeoff between solving a problem with an integrator that takes fewer steps
versus using one that takes more time for each step will vary with each problem.
Factors such as numerical stiffness (or lack of) and the number of discontinuities
present in the ODE's will somteimes cause ode23 to be more effective than ode78,
& vice-versa.
Integrator costs in right-hand-side (RHS) evaluations:
- ode23.m : requires 3 RHS function evaluations per step
- ode45.m : requires 6 RHS function evaluations per step (+1 for the Dormand-Prince pair)
- ode78.m : requires 13 RHS function evaluations per step
- rk2fixed.m : requires 2 RHS function evaluations per step
- rk4fixed.m : requires 4 RHS function evaluations per step
- rk8fixed.m : requires 13 RHS function evaluations per step
If you are interested in experimenting with pendulum.m, try turning on
the 'trace' variable for screen output. This increases execution time
but provides a way to monitor the problem during the integration.
----------------------------------------------------------------------
Two files are from other people, distributed with permission:
(a) rk4fixed.m was written by:
Dr. Raul Longoria, Dept. of Mechanical Engineering,
The Univ. of Texas at Austin
(b) ode78.m was originally written by:
Dr. Howard Wilson &
Daljeet Singh, Dept. Of Electrical Engineering,
The University of Alabama
----------------------------------------------------------------------
Bugs or changes or comments should be directed to the email address
below.
---
Marc Compere, comperem@asme.org
created : 06 October 1999
modified: 02 October 2019
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
- MATLAB > Mathematics > Numerical Integration and Differential Equations > Ordinary Differential Equations >
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.