bvpinit

Builds the initial mesh and guess for a boundary value problem solver.

Category: Mathematics > Numerical Integration and Differential Equations

Syntax

solinit = bvpinit(x, yinit)

Uses the mesh x and a constant guess vector yinit.

solinit = bvpinit(x, yinitfun)

Computes the guess at each mesh point with a function handle y = yinitfun(x).

solinit = bvpinit(x, yinit, params)

Also supplies initial values for unknown parameters.

Description

Nonlinear boundary value problems depend on the starting guess, so choosing it well is part of the solution. A constant guess is the simplest; a function handle lets you encode what you know of the shape of the answer.

The mesh only needs to be reasonable, because the solver refines it. More points help where the solution is expected to vary quickly.

Input arguments

x
Vector of mesh points; its first and last entries are the boundary points a and b.
yinit
Vector with one guess per solution component, or a function handle.
params
Vector of guesses for unknown parameters.

Output arguments

solinit
Structure with fields x and y (and parameters), to pass to bvp4c or bvp5c.

Example

Constant guess

solinit = bvpinit(linspace(0, 1, 5), [0; 1]);
solinit.x
solinit.y
Output
ans = 1×5

         0    0.2500    0.5000    0.7500    1.0000
ans = 2×5

     0     0     0     0     0
     1     1     1     1     1

See also

bvp4c bvp5c bvpset bvpxtend