decic
Finds consistent initial conditions for a fully implicit differential equation.
Category: Mathematics > Numerical Integration and Differential Equations
Syntax
[y0mod, yp0mod] = decic(odefun, t0, y0, fixed_y0, yp0, fixed_yp0)
Adjusts the free components of y0 and yp0 so that odefun(t0, y0mod, yp0mod) = 0.
[y0mod, yp0mod] = decic(___, options)
Also applies tolerances from odeset.
Description
An implicit solver such as ode15i needs starting values that already satisfy the equation. decic computes them by holding the components you mark as fixed and solving for the rest. The number of free components must match the number of equations.
If the equation is not consistent for any choice of free values, the function reports that it failed to converge.
Input arguments
odefun- Handle
res = odefun(t, y, yp)of the implicit systemf(t, y, y') = 0. t0- Initial time.
y0, yp0- Initial guesses for the solution and its derivative.
fixed_y0, fixed_yp0- Vectors of 1 and 0 marking which components must be kept (1) or may be changed (0).
Output arguments
y0mod, yp0mod- Consistent initial values, close to the guesses, ready for
ode15i.
Example
y' + y = 0 with y(0) = 1
f = @(t, y, yp) yp + y;
[y0, yp0] = decic(f, 0, 1, 1, 0, 0)
Output
y0 = 1
yp0 = -1