






Solving ODEs in Matlab -- tutorial
In this quick tutorial, we will show you how to solve simple ode(s) using Matlab’s powerful ode solvers. I assume you at least know some basic operations in Matlab, such as how to write an M-file , change the current directory to the one you saved the file and add the directory to the path, etc.
Matlab contains several routines to solve single or sets of odes. Among them, ode45 and ode23 are often used and should work for most problems you will encounter. Ode23 uses 2nd and 3rd order Runge-Kutta formulas and ode45 uses 4th and 5th order formulas. For most of the time, ode45 should be the first one you try. We will use ode45 in the examples of this tutorial.
There are four topics. Click the one you would like to learn to follow the link:
Links to this Page