Shooting Method for Boundary Value Problem Solving
Boundary Value Problem Solving method Shooting
method Continuous Method Compare
matlab bvp4c, bvp5c
Propblem solve problem
ODE BVP Solve
..
Example
to=0, tf=1, y1o=y2=1, y1f=2, y2f=3;
the system of nonlinear equations
function F = dEqs(t,y) % Differential equations.
F = zeros(4,1);
F(1) = y(3)^2;
F(2) = sqrt(y(4))-y(1);
F(3) = y(2)+y(1);
f(4) = y(1)-y(3);
Initial Con
function y = inCond(u) % Initial conditions; u(1)
y = [1 1 u(1) u(2)]; % and u(2) are unknowns.
Initial condition ODE Integrate the system of nonlinear
equations
function r = residual(u) % Bounday residuals.
global XSTART XSTOP
r = zeros(length(u),1);
x = XSTART;
[xSol,ySol] = ode45(@dEqs,[x XSTOP],inCond(u));
[m,n] = size(ySol);
r(1) = ySol(m,1)-2;
r(2) = ySol(m,2)-3;
function u(1) and u(2) equations က r(1) and r(2)
two unknowns and two equations solving the system of
nonlinear equations solving system of nonlinear equations F(x)=0
Matlab fsolve function fsolve
built-in trust region method ပါ။ built-in algorithm
options Gauss-newton or Levenberg-Marquardt change
root finding
newton-raphson method newton-raphson method
Advanced Engineering mathematics
Newton-rapson method matlab
function root = newtonRaphson2(func,x,tol)
% Newton-Raphson method of finding a root of simultaneous
% equations fi(x1,x2,...,xn) = 0, i = 1,2,...,n.
% USAGE: root = newtonRaphson2(func,x,tol)
% INPUT:
% func = handle of function that returns[f1,f2,...,fn].
% x = starting solution vector [x1,x2,...,xn].
% tol = error tolerance (default is 1.0e4*eps).
% OUTPUT:
% root = solution vector.
if nargin == 2; tol = 1.0e4*eps; end
if size(x,1) == 1; x = x'; end % x must be column vector
for i = 1:150
[jac,f0] = jacobian(func,x);
if sqrt(dot(f0,f0)/length(x)) < tol
root = x; return
end
dx = jac\(-f0);
%dx=-1e-3;
x = x + dx;
if sqrt(dot(dx,dx)/length(x)) < tol*max(abs(x),1.0)
root = x; return
end
end
error('Too many iterations')
function [jac,f0] = jacobian(func,x)
% Returns the Jacobian matrix and f(x).
h = 1.0e-4;
n = length(x);
jac = zeros(n);
f0 = feval(func,x)
for i =1:n
temp = x(i);
x(i) = temp + h;
f1 = feval(func,x);
x(i) = temp;
jac(:,i) = (f1 - f0)/h;
end
newton-raphson jacobian function finite difference method
.. Newton-raphson function two
unknowns two equations function
function shoot4nl
% Shooting method for nonlinear 4th-order boundary
% value problem in Example.
global XSTART XSTOP % Make these params. global.
XSTART = 0; XSTOP = 1; % Range of integration.
u = [-1 1]; % Trial values of u(1)
% and u(2).
x = XSTART;
u = newtonRaphson2(@residual,u)
function run y3 and y4 initial value
u=
-1.3777
11.4519
y3 and y4
Boundary Value Problem
[xSol,ySol] = ode45(@dEqs,[x XSTOP],inCond(u));
y1=ySol(:,1);
y2=ySol(:,2);
plot(xSol,y1)
grid on
figure
plot(xSol,y2)
Fig(1) change of y1
ႈ
ႈ
fig(2).change of y2
fig(1) and fig(2)
Newton-raphson method matlab က fsolve function
u
u=
-1.2250 11.0197
y3 and y4 initial ODE integrate
Fig(3).change of y1
Fig(4).change of y4
fig(3) and fig(4)
solving system of nonlinear equations
system of nonlinear equations
(1) steepest desent method
(2) bisection method
(3) newton method
(4) newton-raphson method
(5) gauss-newton method
(6) quasi-newton method
(7) Levenberg-Marquardt method
(8) dogleg method
problem method
matlab fsolve
strong
convergence Myanmar Astronomy
presentation for Shanghai BVP convergence
initial sensitive Problem post
က continuous method convergence
core2duo prosessor, RAM 4Gb Run
solve အ run run
method powell’s hybrid method
bluephoenix
‘
’
‘
’
‘ ’ post
။
Mtssnrty