From the series: Solving ODEs in MATLAB
Cleve Moler, MathWorks
We can get to documentation for the MATLAB ODE Suite by entering this command at the MATLAB prompt-- doc ode45. This will bring us to an extensive documentation for MATLAB ode45 that includes among other things this chart that compares MATLAB ODE solvers. There are seven of them and this compares their various attributes. As we've said before, MATLAB ode45 is the workhorse. It's a nonstiff solver with medium accuracy that is the first one you should try, and we use it most of the time.
I have a soft heart in my heart for MATLAB ode23. It's a nonstiff solver with low accuracy, but its accuracy that's appropriate for graphics work because the step size it chooses is appropriate for most graphics work. MATLAB ode113 we haven't talked about it yet, there could be a comma between the 1 and the 13 here because this is a variable order method where the order varies all the way from 1 to 13. It's a multi-step method that saves history.
If, you know about these things, it's an Adams-Moulton method. I associate this with worked done at Jet Propulsion Laboratory years ago for computing orbits of planets and satellites, which of course are very smooth and go on for years. It can have very high accuracy requirements.
Then there are the stiff solvers. There are four of them-- 15s, 23s, and the twins, the trapezoid rules. 15s is the primary stiff solver, low to medium accuracy. If you find ode45 is slow, taking lots of steps-- indication that the problem is stiff-- try 15s.
23s can be as a low order method, low accuracy, and used at crude error tolerances. We haven't talked about mass matrices. This is where there's a matrix in front of the derivative term, and this can be used with constant mass matrices. And then the two routines with T's in their name are based on the trapezoidal rule, and they're for use with problems without any numerical damping. You can see the documentation for more details on the trapezoid methods.
That's the MATLAB ODE Suite seven solvers, three for nonstiff problems and four for stiff problems. You may well get through with never using anything but ode45 may well serve all your needs.
There's a second chart in the documentation that summarizes all the options that are available through the ODE Set function. We've briefly mentioned the tolerances, RelTol and AbsTol-- the output function-- these are available in all seven of the solvers.
There are various other functions-- various other options-- available for more specialized work, including event handling, providing a Jacobian to the stiff solvers so they don't have to work so hard taking numerical differences, options associated with the mass matrices, providing a limit on the step size. These are all our options that can be specified through ode Set for more specialized work with the ODE solvers.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .Select web site
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.