- #1
patric44
- 296
- 39
- Homework Statement
- the temperature distribution of a current carrying wire using Matlab using the shooting method ?
- Relevant Equations
- in the figure .
hi guys
i was trying to solve this non linear ode using the shooting algorithm in Matlab :
i am not sure how to solve it using the normal shooting algorithm i have , since no other boundary at x = L/2 was given to check the shooting ?!
i was trying to solve this non linear ode using the shooting algorithm in Matlab :
i am not sure how to solve it using the normal shooting algorithm i have , since no other boundary at x = L/2 was given to check the shooting ?!
Matlab:
function dTdx = bar_temp(x,y)
k = 72;
h = 2000;
epsilon = 0.1;
sigma = 5.67e-8;
i = 2;
rho = 32e-8;
Tinf = 300;
D = 7.62e-5;
L = 4e-3;
p = (4*h)/(k*D);
q = (4*epsilon*sigma)/(k*D);
z =-(i^2*rho)/(k*(pi/4*D^2)^2);
dTdx = [y(2);(p*(y(1)-Tinf))+(q*(y(1)^4-(Tinf)^4))+z];
end
Matlab:
function r = bar_res(IC_guess)
T0 = 300;
TL = ??;
L = 4e-3;
[x,y] = ode45(@bar_temp,[0,L/2],[T0 IC_guess]);
r = y(end,1)-TL;
end
Matlab:
L = 4e-3;
T0 = 300;
guess = fzero(@(x)bar_res(x),-50);
[x,y] = ode45(@bar_temp,[0,L/2],[T0 guess]);
plot(x,y(:,1));
xlabel('x')
ylabel('T')
title('Temperature Distribuiton')