| ODE23 integrates a system of ordinary
differential equations using 2nd and 3rd order Runge-Kutta formulas. [T,Y] = ODE23( 'F', [ T0 Tfinal] , Y0 ) integrates the system of ordinary differential equations described by the M-file F.M, over the interval T0 to Tfinal, with initial conditions Y0. |
F - String containing name of user-supplied problem description.
Y0 - Initial value column-vector.
T - Returned integration time points (column-vector).
Y - Returned solution, one
solution
column-vector per tout-value.
The result can be displayed by: plot(tout, yout).

EXAMPLES
1) 1st order linear differential equation
Solve the following DE: dx/dt + 3x + 4 = 0. Rewrite the DE as dx/dt = -3x - 4. To calculate x on the interval 0 £ t £ 3, with initial value of x(0) = 12:
Define a function that describes the differential equation. To do this, use File menu option New to create the function below. Save it as LFO (MATLAB will add .m).
function xdot = LFO(t,x)
xdot= - 3*x - 4; (that’s it... save the function file)
Now submit this function to the ode23 function, which computes ordinary differential equations using 2nd and 3rd order Runge-Kutta methods.
ª [t,x]=ode23('LFO', [0 3], 12);
ª plot(t,x)
2) 2nd order linear differential
equation
Solve the following differential equation on
the
interval 0 £
t £ 10:
d2v/dt2
+2 dv/dt + 3 v = 4
with initial value of v(0) = 12 and v’(0) = 0:
Rewrite the differential equation as a system of first order differential equations: let v(1) = v and v(2) = dv/dt = dv(1)/dt. Then,
v’(2)= -2v(2) - 3v(1) + 4
Define a function that describes the differential equation. To do this, use File menu option New to create the function below. Save it as RLC.
function vdot = RLC(t,v)
vdot(2, 1)= -2*v(2) - 3*v(1) + 4;
>> initial = [ 12 0 ]’;
>> [t,v]=ode23( 'RLC' , [0 10] , initial );
>> plot(t, v)
You will see TWO functions plotted as functions of t: v and v'.