Extend solution to ODE

extends
the solution `solext`

= odextend(`sol`

,`odefun`

,`tfinal`

)`sol`

by integrating `odefun`

from `sol.x(end)`

to `tfinal`

,
using the same ODE solver that created `sol`

. The
function `odefun`

can be different than the original
function used to compute `sol`

. The lower bound for
the independent variable in `solext`

is the same
as in `sol`

, that is, `sol.x(1)`

.
By default, `odextend`

uses:

The initial conditions

`y = sol.y(:,end)`

for the subsequent integration.The same integration properties and additional input arguments that the ODE solver originally used to compute

`sol`

. This information is stored in the solution structure`sol`

and is later returned in`solext`

. Unless you want to change these values, you do not need to pass them to`odextend`

.

specifies
new initial conditions `solext`

= odextend(`sol`

,`odefun`

,`tfinal`

,`y0`

)`y0`

for the extended integration
instead of using `sol.y(:,end)`

.

*For the ode15i solver:*

`y0`

must
be an m-by-2 matrix containing column vectors of initial conditions
for the solution components and their derivatives, ```
y0 = [yinit
ypinit]
```

.

uses
the integration options defined by `solext`

= odextend(`sol`

,`odefun`

,`tfinal`

,`y0`

,`options`

)`options`

, which
is an argument created using the `odeset`

function.
The specified options override the options that the ODE solver originally
used to compute `sol`

. You can optionally specify ```
y0
= []
```

to use default initial conditions.