- Function File:
*[*`] =`**ode45***(*`@fun`,`slot`,`init`, [`opt`], [`par1`,`par2`, …]) - Command:
*[*`sol`] =**ode45***(*`@fun`,`slot`,`init`, [`opt`], [`par1`,`par2`, …]) - Command:
*[*`t`,`y`, [`xe`,`ye`,`ie`]] =**ode45***(*`@fun`,`slot`,`init`, [`opt`], [`par1`,`par2`, …]) -
This function file can be used to solve a set of non–stiff ordinary differential equations (non–stiff ODEs) or non–stiff differential algebraic equations (non–stiff DAEs) with the well known explicit Runge–Kutta method of order (4,5).

If this function is called with no return argument then plot the solution over time in a figure window while solving the set of ODEs that are defined in a function and specified by the function handle

`@fun`. The second input argument`slot`is a double vector that defines the time slot,`init`is a double vector that defines the initial values of the states,`opt`can optionally be a structure array that keeps the options created with the command`odeset`

and`par1`,`par2`, … can optionally be other input arguments of any type that have to be passed to the function defined by`@fun`.If this function is called with one return argument then return the solution

`sol`of type structure array after solving the set of ODEs. The solution`sol`has the fields`x`of type double column vector for the steps chosen by the solver,`y`of type double column vector for the solutions at each time step of`x`,`solver`of type string for the solver name and optionally the extended time stamp information`xe`, the extended solution information`ye`and the extended index information`ie`all of type double column vector that keep the informations of the event function if an event function handle is set in the option argument`opt`.If this function is called with more than one return argument then return the time stamps

`t`, the solution values`y`and optionally the extended time stamp information`xe`, the extended solution information`ye`and the extended index information`ie`all of type double column vector.For example, solve an anonymous implementation of the Van der Pol equation

fvdb = @(vt,vy) [vy(2); (1 - vy(1)^2) * vy(2) - vy(1)]; vopt = odeset ("RelTol", 1e-3, "AbsTol", 1e-3, \ "NormControl", "on", "OutputFcn", @odeplot); ode45 (fvdb, [0 20], [2 0], vopt);

**See also:** odepkg.

Package: odepkg