MATLAB Answers

Please explain Matlab's naming convention for odepq

15 views (last 30 days)
There are ODE solvers built into Matlab, all named in the form of odepq.
I understand p is the order. For Euler's method it is order 1, Heun's and Midpoint are order 2, while Runge-kutta is order 4. What is the q here?


Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 22 Jan 2021
Edited: Walter Roberson on 22 Jan 2021
p is the order of the calculation used to predict the solution, and q is the order of the calculation used for the error estimate.
"ode113 is a variable-step, variable-order (VSVO) Adams-Bashforth-Moulton PECE solver of orders 1 to 13. The highest order used appears to be 12, however, a formula of order 13 is used to form the error estimate and the function does local extrapolation to advance the integration at order 13."


Show 1 older comment
Walter Roberson
Walter Roberson on 22 Jan 2021
The ode* functions supplied by Mathworks (outside of one posting in Answers) are all variable-step solvers. They pick a step size, and make a number of careful calls to the supplied function and calculate with those to come up with an estimate of the new boundary conditions for all of the parameters. But then they make some extra calls based on the prediction, and make another prediction, and cross-check the error between the predicted value and the actual value. If the actual value is close enough to the predicted value then the step is "accepted" and the predicted new boundaries are put to use in the next cycle, and the step size is increased. But if the cross-check gives an actual value too distant from the predicted then the step is rejected and the new boundary is not used, and ode*() shrinks the step size and tries again from where it was .
In this way, expanding the step for success and shrinking for failure, the function can move quickly over sections that are well approximated by order p, and then when it gets to a steeper section, slows down.
The location to do the cross-check at is chosen by the same principles used for the choice of careful trial points, but with a higher order function. Most of the ode functions only need to perform one extra call as they are q=p+1, but sometimes there is a higher difference and (q-p) extra calls are made.
Steven Lord
Steven Lord on 22 Jan 2021
FYI Cleve Moler offers a bit more of the details behind the solvers in section 7.12 (the chapter titled "Ordinary Differential Equations") of his textbook "Numerical Computing with MATLAB" that is available here.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!