Using the Shooting Method

Hi all,
I'm looking to solve the following system of equations with boundary conditions using the shooting method:
F''=F^2-G^2+F'H
G''=2FG+G'H
H'=-2F
along with the conditions F(0)=0, G(0)=1, H(0)=0, F(infinity)=0, G(infinity)=0.
I've found the solution using the BVP4C solver but need to also be able to find the solution using the shooting method.
I'm really quite new to MATLAB and don't really know where to start!
Any help anyone can give me would be greatly appreciated. Thanks!

Answers (1)

Titus Edelhofer
Titus Edelhofer on 30 Oct 2012
The first thing to do is independent of the programming: reformulate your second order system by a (larger) first order system. Once you have that, use e.g. ode45 to solve it.
Titus

4 Comments

O.k I think this is the correct way to reformulate the system of equations
function dy = VK(x,y)
dy = zeros(5,1);
dy(1) = y(2);
dy(2)=y(1)^2-y(3)^2+y(2)*y(5);
dy(3)=y(4);
dy(4)=2*y(1)*y(3)+y(4)*y(5);
dy(5)=-2*y(1);
then call ODE45 as such
[x,y] = ode45('VK',[0 5], [0 0 1 0 0]);
To solve this system of equations.
MATLAB returns a warning message
"Unable to meet integration tolerances without reducing the step size below the smallest value allowed."
But I think in principle this is correct? Also thanks for your speedy reply.
Actually the initial conditions should be more like:
[0 u(1) 1 u(2) 0]
where u(1) and u(2) are the values of F'(0) and G'(0) (unknowns) respectively.
How do I start to implement the shooting method from this? I've seen cases where one unknown is being 'shot' for but not for two unknowns.
Any help would be great. Thanks.
If you have two unknowns I would use e.g. fminsearch where your objective function is the error (quadratic difference) between the target (coming from the "other" boundary condition) and the values you get at the end of the shoot (via ode45).
Thanks for your input,
I think I'm just about there with this now.
I feel it was my limited MATLAB knowledge that was letting me down. Still things should get better with time and practice!

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 30 Oct 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!