Vous êtes sur la page 1sur 2

MATLAB CODE

% MATLAB CODE for EXTENDEDN FIN ANALYTICAL AND NUMERICAL SOUTION


%inputs
k=111;
h=12;
Traw=[150.45325 130.744678 97.627026 71.77222 54.384379 42.842029
35.371147 30.363053 28.157733 26.495725 25.394743 22.02263
];
Texper=Traw+273;
Tinf=Texper(12);
Tb=Texper(1);
dx=(23*25.4)/11000;
di=0.009525;
L=0.6096;
X=zeros(1,11);
X(1,1)=0;
X(1,2)=0.01905;
for u=3:11
X(1,u)=X(1,u-1)+0.0635;
end

% Calculations

Texp=Texper(1:11)
A=((pi/4)*di^2);
P=pi*di;
m=sqrt(h*P/(k*A));
hmk=(h/(m*k));
lx=L-X
mlx=m.*lx
caseb=Tinf+((cosh((mlx))+(hmk.*sinh(mlx)))*(Tb-
Tinf))/(cosh(m*L)+hmk.*sinh(m*L))
casea=Tinf+(exp(-m.*X)*(Tb-Tinf))

a=(1/(dx^2));
b=(-2/(dx^2))-((h*P)/(k*A));
c=-((h*P)*Tinf)/(k*A);
d=-k*A/dx;
e=(k*A)/dx+h*(A+(dx/2)*P);
f=(Tinf*h)*(A+(dx/2)*P);
% Formation of matitrix
coeff=zeros(11);
for i=1:11;
coeff(i,i)=b;
end
for j=1:10;
coeff(j,j+1)=a;
end
for x=2:10;
coeff(x,x-1)=a;
end
coeff(11,10)=d;
coeff(11,11)=e;
% Formation of B matrix
B=zeros(11,1);
B(1,1)=(c-a*Tb);
for y=2:10
B(y,1)=c;
end
B(11,1)=f;
% Solution of matrix A
T=inv(coeff)*B

plot(X,T,'+g:',X,caseb,'*k--',X,Texp,'+m-')
legend('Numerical','Case B','Experimetnal')
xlabel('Distance x(m)')
ylabel('Temperaure (K)')
figure()
plot(X,casea,'+g:',X,caseb,'*k--',X,Texp,'+m-')
legend('Case A','Case B','Experimetnal')
xlabel('Distance x(m)')
ylabel('Temperaure (K)')

Vous aimerez peut-être aussi