07-10: Boundary Value Problems of Differential Equations
Now let us consider solutions of boundary value problems of ODEs
So far the ODE problems we studied are initial value problems
that is we known the initial values
and find the numerical solutions of the ODEs
In real applications
some times apart from the initial values
we may known some of the final values
This type of problems is also known as boundary value problems
Let us consider an easy example
Assume that we have a second-order differential equation
We explored earlier that
the initial values of y and first-order derivative of y
For some applications
we do not know the derivative of y at point a
what we know is the value of y at time b instead
that is the value of the terminal
Therefore the problem is also known as the boundary value problem
How can we solve boundary value problems?
We can make a guess
since we do not know the value y' at time a
we can assign it an initial value
for instance we can set it as 4
Therefore we can used the previously used method
to solve the initial value problem
After that we can find the obtained value of y at the end terminal
Of course it is not 2
There is an error between the value and the expected 2
We can use the error
to modify the value of y' at time a
This is something like in shooting at target
to set an initial angle first
shoot at one point
There is a difference between the point at the expected target
We can adjust of the angle of the gun
according the the distance
After several iterations
finally the target can be shot
Therefore boundary value problems can be solved with shooting target method
In MATLAB there is an existing solver
called bvp5c
where bvp is the abbreviation of boundary value problem
5c is the version number
How can we call such a function?
We can make the initialization process
For instance we can generate a vector
selecting M points
Later we shall talk about M
What is its impact on the final results?
Constructing an initial vector
and call the initialization function
to create a variable named sinit
With such a variable
we can call function bvp5c to solve the differential equation
Here two anonymous functions are used
One for describing the differential equation itself
the other for describing the boundary values
Therefore we can call the function such as bvp5c
to solve the boundary value problems
so as to find the expected solutions
Now let us consider the boundary value problem below
The standard boundary conditions to let the right hand equals to 0
For instance in the first equation
we can move -1 to the left and let the right side equals 0
It is now become y(0)+1 equals 0
For the second equation
y(pi/2) minus 1 equals 0 to change to standard form
Further we can modify the boundary conditions
For y itself the corresponding state is x1
0 corresponds to point a and pi/2 corresponds to point b
Therefore the boundary conditions
can be modified into the case like that
Modifying it to the standard form
we can use the following form
to describe f2 for the boundary conditions
We can denote the given points xa and xb
and they can be used as input arguments
and based on the formula it is natural to write it as
the first equation like xa(1) plus 1
This is obvious that xb(1) minus 1
So we can use this form to describe the boundary conditions
The description of f1 is identical to the ones described earlier
After that we can call the following statements
to start initialization process
where as I said M can be temporarily set to 5
then we can construct an initial vector of sinit
With this information
we can solve directly the boundary value problems
and finally we can obtain the following results
Therefore the curves are the solutions of the original problems
Therefore the solutions in blue is the curve of x1
That is the signal y
Therefore it can be seen that
These points happen to satisfy the boundary values of the ODEs
It can be seen that the solution is correct
On the other hand
the solution curves we obtained are rather rough
What is the reason?
The problem is the selection of M
which is set too small
Therefore if the computational load is acceptable
we can select a large value for M
For instance selected as 25
Then solve again the differential equation
The curves obtained now
and they are much smoother than the ones we obtained before
Therefore with this method we can chose a suitable M
which leads to accurate solutions of boundary value problems
We have learnt boundary value problems
and it can be extended to handle more complicated cases
For instance in the boundary value problem
in the problem
we can convert it easily into the following cases
The boundary value functions can be described
and we can find the expected solutions
Now let us consider the boundary value ODEs with parameters
Assume that we have an ODE like this
where alpha and beta are unknown parameters
and the original equation is eqiuvalent to second-order ODEs
To solve uniquely the differential equations
we must have four known quantities
For instance in the differential equations
we have these four quantities
and they can be used to solve the equations
Meanwhile the values of alpha and beta can also be found
How can we solve the problem then?
Since this is a second-order ODE
we can introduce state variables x1 and x2
Besides introducing two extra parameters
to represent the additional parameters alpha and beta
we can write out the following statements
to describe the ODE and the boundary values
Note that the input arguments
not only contain t and x, but also vector v
After the descriptions
we can call the following statements
to solve directly the differential equations
and finally the solutions of the ODE can be found
These are the solutions of the original ODEs
In some cases if x1 and x2
are the initial state variables we selected earlier
If the two state variables are not selected properly
the solution process may become singular
and we cannot find the correct solutions
If this case happens
we should select again the state variables x1 and x2
and then solve again
After the solution process we should validate
whether the solutions are correct or not
The validation method is the same as the ones we used before
That is to assign different control parameters
and see whether constant solutions can be found
Well that is all for the topic