Solving BVP Problems
This section describes:
Example: Mathieu's Equation
This example determines the fourth eigenvalue of Mathieu's Equation. It illustrates how to write second-order differential equations as a system of two first-order ODEs and how to use
bvp4c to determine an unknown parameter .
The task is to compute the fourth () eigenvalue of Mathieu's equation
Because the unknown parameter is present, this second-order differential equation is subject to three boundary conditions
The demo |
bvp4c, you must rewrite the equations as an equivalent system of first-order differential equations. Using a substitution and , the differential equation is written as a system of two first-order equations
bvp4ccan use. Because there is an unknown parameter, the function must be of the form
qis shared with the outer function:
See Finding Unknown Parameters for more information about using unknown parameters with
bvpinit, you need to provide initial guesses for both the solution and the unknown parameter.
mat4initprovides an initial guess for the solution.
mat4inituses because this function satisfies the boundary conditions and has the correct qualitative behavior (the correct number of sign changes).
In the call to
bvpinit, the third argument,
lambda, provides an initial guess for the unknown parameter .
This example uses
@ to pass
mat4init as a function handle to
See the |
bvp4cwith the functions
mat4bcand the structure
devalto evaluate the numerical solution at 100 equally spaced points in the interval , and plot its first component. This component approximates .
See Evaluating the Solution at Specific Points for information about using
Finding Unknown Parameters
bvp4c solver can find unknown parameters for problems of the form
You must provide
bvp4c an initial guess for any unknown parameters in the vector
solinit.parameters. When you call
bvpinit to create the structure
solinit, specify the initial guess as a vector in the additional argument
bvp4c function arguments
bcfun must each have a third argument.
While solving the differential equations,
bvp4c adjusts the value of unknown parameters to satisfy the boundary conditions. The solver returns the final values of these unknown parameters in
sol.parameters. See Example: Mathieu's Equation.
Evaluating the Solution at Specific Points
The collocation method implemented in
bvp4c produces a C1-continuous solution over the whole interval of integration . You can evaluate the approximate solution, , at any point in using the helper function
deval and the structure
sol returned by
deval function is vectorized. For a vector
ith column of
Sxint approximates the solution .
|Boundary Value Problem Solver||Using Continuation to Make a Good Initial Guess|
© 1994-2005 The MathWorks, Inc.