
Input and Output functions
<deval> - Evaluates the solution of a differential equation problem.
DEVAL Evaluate the solution of a differential equation problem.
SXINT = DEVAL(SOL,XINT) evaluates the solution of a differential equation
problem at all the entries of the vector XINT. SOL is a structure returned
by an initial value problem solver (ODE45, ODE23, ODE113, ODE15S, ODE23S,
ODE23T, ODE23TB, ODE15I), a boundary value problem solver (BVP4C, BVP5C),
or a delay differential equations solver (DDE23, DDESD). The elements of
XINT must be in the interval [SOL.x(1) SOL.x(end)]. For each I, SXINT(:,I)
is the solution corresponding to XINT(I).
SXINT = DEVAL(SOL,XINT,IDX) evaluates as above but returns only
the solution components with indices listed in IDX.
SXINT = DEVAL(XINT,SOL) and SXINT = DEVAL(XINT,SOL,IDX) are also acceptable.
[SXINT,SPXINT] = DEVAL(...) evaluates as above but returns also the value
of the first derivative of the polynomial interpolating the solution.
For multipoint boundary value problems or initial value problems extended
using ODEXTEND, the solution might be discontinuous at interfaces.
For an interface point XC, DEVAL returns the average of the limits from
the left and right of XC. To get the limit values, set the XINT argument
of DEVAL to be slightly smaller or slightly larger than XC.
Class support for inputs SOL and XINT:
float: double, single
See also
ODE solvers: ode45, ode23, ode113, ode15s,
ode23s, ode23t, ode23tb, ode15i
DDE solvers: dde23, ddesd
BVP solvers: bvp4c, bvp5c
Reference page in Help browser
doc deval
<odextend> - Extends the solutions of a differential equation problem.
ODEXTEND Extend solution of initial value problem for differential equations.
SOLEXT = ODEXTEND(SOL,ODEFUN,TFINAL) extends the solution stored in SOL to
the interval [SOL.x(1), TFINAL]. SOL is an ODE solution structure created
with an ODE solver. ODEFUN is a function handle. For a scalar T and a
column vector Y, ODEFUN(T,Y) returns a column vector of the derivatives.
ODEXTEND extends the solution by integrating the problem from SOL.x(end)
to TFINAL, using the same ODE solver that created SOL. By default, ODEXTEND
uses SOL.y(:,end) as the initial conditions for that subsequent integration.
The derivative function, integration properties, and additional input
arguments used to compute SOL are stored as part of that solution structure.
Unless these values change, they do not need to be passed to ODEXTEND.
The values passed to ODEXTEND will be stored in SOLEXT.
Use DEVAL and SOLEXT to evaluate the extended solution at any point between
SOL.x(1) and TFINAL.
SOLEXT = ODEXTEND(SOL,ODEFUN,TFINAL,YINIT) solves as above, but uses
the column vector YINIT as new initial conditions at SOL.X(end).
To extend solutions obtained with ODE15I, use the syntax
SOLEXT = ODEXTEND(SOL,ODEFUN,TFINAL,[YINIT,YPINIT]), where the column
vector YPINIT is the initial derivative of the solution.
SOLEXT = ODEXTEND(SOL,ODEFUN,TFINAL,YINIT,OPTIONS) solves as above, with
the integration properties specified in OPTIONS replacing the values used
to compute SOL. See ODESET for details on setting OPTIONS properties.
Use YINIT = [] as a placeholder if no new YINIT is specified.
Example
sol=ode45(@vdp1,[0 10],[2 0]);
sol=odextend(sol,@vdp1,20);
plot(sol.x,sol.y(1,:));
uses ODE45 to solve the system y' = vdp1(t,y) on the interval [0 10].
Then, it extends the solution to [0 20] and plots its first component.
Class support for inputs SOL, TFINAL, and YINIT:
float: double, single
See also
ODE solvers: ode23, ode45, ode113, ode15s, ode23s, ode23t, ode23tb
implicit ODEs: ode15i
options handling: odeset, odeget
evaluating solution: deval
function handles: function_handle
Reference page in Help browser
doc odextend
<odeplot> - Time series ODE output function.
ODEPLOT Time series ODE output function.
When the function odeplot is passed to an ODE solver as the 'OutputFcn'
property, i.e. options = odeset('OutputFcn',@odeplot), the solver calls
ODEPLOT(T,Y,'') after every timestep. The ODEPLOT function plots all
components of the solution it is passed as it is computed, adapting
the axis limits of the plot dynamically. To plot only particular
components, specify their indices in the 'OutputSel' property passed to
the ODE solver. ODEPLOT is the default output function of the
solvers when they are called with no output arguments.
At the start of integration, a solver calls ODEPLOT(TSPAN,Y0,'init') to
initialize the output function. After each integration step to new time
point T with solution vector Y the solver calls STATUS = ODEPLOT(T,Y,'').
If the solver's 'Refine' property is greater than one (see ODESET), then
T is a column vector containing all new output times and Y is an array
comprised of corresponding column vectors. The STATUS return value is 1
if the STOP button has been pressed and 0 otherwise. When the
integration is complete, the solver calls ODEPLOT([],[],'done').
See also odephas2, odephas3, odeprint, ode45, ode15s, odeset.
<odephas2> - 2-D phase plane ODE output function.
ODEPHAS2 2-D phase plane ODE output function.
When the function odephas2 is passed to an ODE solver as the 'OutputFcn'
property, i.e. options = odeset('OutputFcn',@odephas2), the solver
calls ODEPHAS2(T,Y,'') after every timestep. The ODEPHAS2 function plots
the first two components of the solution it is passed as it is computed,
adapting the axis limits of the plot dynamically. To plot two
particular components, specify their indices in the 'OutputSel' property
passed to the ODE solver.
At the start of integration, a solver calls ODEPHAS2(TSPAN,Y0,'init') to
initialize the output function. After each integration step to new time
point T with solution vector Y the solver calls STATUS = ODEPHAS2(T,Y,'').
If the solver's 'Refine' property is greater than one (see ODESET), then
T is a column vector containing all new output times and Y is an array
comprised of corresponding column vectors. The STATUS return value is 1
if the STOP button has been pressed and 0 otherwise. When the
integration is complete, the solver calls ODEPHAS2([],[],'done').
See also odeplot, odephas3, odeprint, ode45, ode15s, odeset.
<odephas3> - 3-D phase plane ODE output function.
ODEPHAS3 3-D phase plane ODE output function.
When the function odephas3 is passed to an ODE solver as the 'OutputFcn'
property, i.e. options = odeset('OutputFcn',@odephas3), the solver
calls ODEPHAS3(T,Y,'') after every timestep. The ODEPHAS3 function plots
the first three components of the solution it is passed as it is
computed, adapting the axis limits of the plot dynamically. To plot
three particular components, specify their indices in the 'OutputSel'
property passed to the ODE solver.
At the start of integration, a solver calls ODEPHAS3(TSPAN,Y0,'init') to
initialize the output function. After each integration step to new time
point T with solution vector Y the solver calls STATUS = ODEPHAS3(T,Y,'').
If the solver's 'Refine' property is greater than one (see ODESET), then
T is a column vector containing all new output times and Y is an array
comprised of corresponding column vectors. The STATUS return value is 1
if the STOP button has been pressed and 0 otherwise. When the
integration is complete, the solver calls ODEPHAS3([],[],'done').
See also odeplot, odephas2, odeprint, ode45, ode15s, odeset.
<odeprint> - Command window printing ODE output function.
ODEPRINT Command window printing ODE output function.
When the function odeprint is passed to an ODE solver as the 'OutputFcn'
property, i.e. options = odeset('OutputFcn',@odeprint), the solver calls
ODEPRINT(T,Y,'') after every timestep. The ODEPRINT function prints all
components of the solution it is passed as it is computed. To print only
particular components, specify their indices in the 'OutputSel' property
passed to the ODE solver.
At the start of integration, a solver calls ODEPRINT(TSPAN,Y0,'init') to
initialize the output function. After each integration step to new time
point T with solution vector Y the solver calls STATUS = ODEPRINT(T,Y,'').
If the solver's 'Refine' property is greater than one (see ODESET), then
T is a column vector containing all new output times and Y is an array
comprised of corresponding column vectors. ODEPRINT always returns
STATUS = 0. When the integration is complete, the solver calls
ODEPRINT([],[],'done').
See also odeplot, odephas2, odephas3, ode45, ode15s, odeset.
<bvpinit> - Forms the initial guess for BVP4C.
BVPINIT Form the initial guess for BVP solvers.
SOLINIT = BVPINIT(X,YINIT) forms the initial guess for BVP4C or BVP5C in
common circumstances. The boundary value problem (BVP) is to be solved
on [a,b]. The vector X specifies a and b as X(1) = a and X(end) = b.
It is also a guess for an appropriate mesh. BVP solvers will adapt this
mesh to the solution, so often a guess like X = linspace(a,b,10) will
suffice, but in difficult cases, mesh points should be placed where the
solution changes rapidly.
The entries of X must be ordered. For two-point BVPs, the entries of X
must be distinct, so if a < b, then X(1) < X(2) < ... < X(end), and
similarly for a > b. For multipoint BVPs there are boundary conditions
at points in [a,b]. Generally, these points represent interfaces and
provide a natural division of [a,b] into regions. BVPINIT enumerates
the regions from left to right (from a to b), with indices starting
from 1. You can specify interfaces by double entries in the initial
mesh X. BVPINIT interprets one entry as the right end point of region k
and the other as the left end point of region k+1. THREEBVP exemplifies
this for a three-point BVP.
YINIT provides a guess for the solution. It must be possible to evaluate
the differential equations and boundary conditions for this guess.
YINIT can be either a vector or a function handle:
vector: YINIT(i) is a constant guess for the i-th component Y(i,:) of
the solution at all the mesh points in X.
function: YINIT is a function of a scalar x. For example, use
solinit = bvpinit(x,@yfun) if for any x in [a,b], yfun(x)
returns a guess for the solution y(x). For multipoint BVPs,
BVPINIT calls Y = YINIT(X,K) to get an initial guess for the
solution at x in region k.
SOLINIT = BVPINIT(X,YINIT,PARAMETERS) indicates that the BVP involves
unknown parameters. A guess must be provided for all parameters in the
vector PARAMETERS.
See also bvpget, bvpset, bvp4c, bvp5c, bvpxtend, deval, function_handle.
Reference page in Help browser
doc bvpinit
<bvpxtend> - Forms a guess structure for extending BVP solution.
BVPXTEND Form a guess structure for extending BVP solution.
SOLINIT = BVPXTEND(SOL,XNEW,YNEW) uses solution SOL computed on
[a,b] to form a solution guess for the interval extended to XNEW.
The extension point XNEW must be outside the interval [a,b], but
it can be on either side. The vector YNEW provides a guess for the
solution at XNEW.
SOLINIT = BVPXTEND(SOL,XNEW,EXTRAP) forms the guess at XNEW by
extrapolating the solution SOL. EXTRAP is a string that determines
the extrapolation method. EXTRAP has three values:
'constant' -- YNEW is value at nearer end point of solution in SOL.
'linear' -- YNEW is value at XNEW of linear interpolant to value and
slope at nearer end point of solution in SOL.
'solution' -- YNEW is value of (cubic) solution in SOL at XNEW.
The value of EXTRAP is case-insensitive and only the leading, unique
portion needs to be specified. SOLINIT = BVPXTEND(SOL,XNEW) is a
short form of SOLINIT = BVPXTEND(SOL,XNEW,'constant').
If there are unknown parameters, values present in SOL are used as
initial guess for parameters in SOLINIT. Specify a different guess
PNEW with SOLINIT = BVPXTEND(SOL,XNEW,YNEW,PNEW). With extrapolation,
use SOLINIT = BVPXTEND(SOL,XNEW,EXTRAP,PNEW). Use [] as place holder
for XNEW and YNEW when modifying parameters without changing interval.
See also bvp4c, bvp5c, bvpinit.
Reference page in Help browser
doc bvpxtend
<pdeval> - Evaluates by interpolation the solution computed by PDEPE.
PDEVAL Evaluate the solution computed by PDEPE and its spatial derivative.
When an array SOL is returned by PDEPE, UI = SOL(j,:,i) approximates
component i of the solution of the PDE at time T(j) and mesh points X.
[UOUT,DUOUTDX] = PDEVAL(M,X,UI,XOUT) evaluates the approximation and
its partial derivative Dui/Dx at the array of points XOUT and returns
them in UOUT and DUOUTDX, respectively.
See also pdepe.
Reference page in Help browser
doc pdeval