- #1
patric44
- 300
- 39
- Homework Statement
- solve the following non linear BVP using shooting method in Matlab ?
- Relevant Equations
- in the picture
hi guys
i was trying to use this shooting algorithm from Xue and Chen Scientific Computing with MATLAB book :
to solve this non linear temperature distribution problem :
i checked my Matlab function multiple times but i am keep getting a nonsense graph for the temperature , can someone cheak what's wrong with my algorithm :
the script for the problem :
i will appreciate any help , thanks
i was trying to use this shooting algorithm from Xue and Chen Scientific Computing with MATLAB book :
to solve this non linear temperature distribution problem :
i checked my Matlab function multiple times but i am keep getting a nonsense graph for the temperature , can someone cheak what's wrong with my algorithm :
Matlab:
function [t,y] = nlbound(func,funcv,tspan,xof,tol,varargin)
t0 = tspan(1); tf = tspan(2) ; you = xof(1); yb = xof(2);
m=1 ; m0=0;
while(norm(m-m0)>tol), m0=m ;
[t,v] = ode45(funcv,tspan,[ya;m;0;1],varargin{:});
m = m0-(v(end,1)-yb)/v(end,3);
end
[t,y] = ode45(func,tspan,[ya;m],varargin{:});
end
Matlab:
k = 72;
h = 2000;
epsilon = 0.1;
sigma = 5.67e-8;
i = 2;
rho = 32e-8;
Tinf = 300;
D = 7.62e-5;
L = 4*10^-3;
a1 = (4*h)/(k*D);
a2 = (4*epsilon*sigma)/(k*D);
k = -(i^2*rho)/(k*((pi/4)*D^2)^2);
zeta = k-a1*Tinf-a2*Tinf^4;
% the problem was transformed to a simple form T'' = a1*T+a2*T^4+zeta
f1 = @(t,v)[v(2);a1*v(1)+(a2*v(1)^4)+zeta;v(4);(a1+(4*a2*v(1)^3))*v(3)];
f2 = @(t,x)[x(2);a1*x(1)+a2*x(1)^4+zeta];
x0f = [300,300];
xspan = [0,L];
opts = odeset;
opts.RelTol = 1e-10;
tol = 1e-8;
[t,y] = nlbound(f2,f1,[0,L],[300,300],tol,opts);
plot(t,y(:,1))