MATLAB Function Reference |
Extend the solution of an initial value problem for an ordinary differential equation (ODE)
Syntax
solext = odextend(sol, odefun, tfinal)
solext = odextend(sol, [], tfinal)
solext = odextend(sol, odefun, tfinal, yinit)
solext = odextend(sol, odefun, tfinal, [yinit, ypinit])
solext = odextend(sol, odefun, tfinal, yinit, options)
Description
solext = odextend(sol, odefun, tfinal)
extends the solution stored in sol
to an interval with upper bound tfinal
for the independent variable. odefun
is a function handle. See Function Handles in the MATLAB Programming documentation for more information. sol
is an ODE solution structure created using an ODE solver. The lower bound for the independent variable in solext
is the same as in sol
. If you created sol
with an ODE solver other than ode15i
, the function odefun
computes the right-hand side of the ODE equation, which is of the form . If you created sol
using ode15i
, the function odefun
computes the left-hand side of the ODE equation, which is of the form .
Parameterizing Functions Called by Function Functions, in the MATLAB mathematics documentation, explains how to provide additional parameters to the function odefun
, if necessary.
odextend
extends the solution by integrating odefun
from the upper bound for the independent variable in sol
to tfinal
, using the same ODE solver that created sol
. By default, odextend
uses
y = sol.y(:, end)
for the subsequent integration
sol
. This information is stored as part of the solution structure sol
and is subsequently passed to solext
. Unless you want to change these values, you do not need to pass them to odextend
.
solext = odextend(sol, [], tfinal)
uses the same ODE function that the ODE solver uses to compute sol
to extend the solution. It is not necessary to pass in odefu
n explicitly unless it differs from the original ODE function.
solext = odextend(sol, odefun, tfinal, yinit)
uses the column vector yinit
as new initial conditions for the subsequent integration, instead of the vector sol.y(end)
.
solext = odextend(sol, odefun, tfinal, yinit, options)
uses the integration properties specified in options
instead of the options the ODE solver originally used to compute sol
. The new options are then stored within the structure solext
. See odeset
for details on setting options
properties. Set yinit = []
as a placeholder to specify the default initial conditions.
Example
uses ode45
to solve the system y' = vdp1(t,y)
, where vdp1
is an example of an ODE function provided with MATLAB, on the interval [0 10]
. Then, the commands
extend the solution to the interval [0 20]
and plot the first component of the solution on [0 20]
.
See Also
deval
, ode23
, ode45
, ode113
, ode15s
, ode23s
, ode23t
, ode23tb
, ode15i
, odeset
, odeget
, deval
, function_handle
(@
)
odeset | ones |
© 1994-2005 The MathWorks, Inc.