writing a code for Heat transfer in a steady state but unable to obtain true results

1 回表示 (過去 30 日間)
george mobol
george mobol 2016 年 8 月 1 日
%columns=M
%rows=N
%Ttop=500 % top boundary
%Tleft=500 % left boundary
%Tright=500 % right boundary
%interior node= T(m,n) = 1/4*(T(m+1,n)+T(m-1,n)+T(m,n+1)+T(m,n-1));
% bottom convection equation= T(m,n)= 2*T(m-1,n)+T(m,n-1)+T(m,n+1)+1500-9*T(m,n);
N=5; % Number of columns
M=5; % Number of rows
error_T=ones(5,5);
T_amb = 300;
T=ones(5,5)*T_amb;
T_old=zeros(5,5);
T(:,1)=500;% boundary condition at the left
T(:,5)=500;% boundary condition at the right
T(1,:)=500;% boundary condition at the top
for n=2:4; % convection at the bottom
for m=5:5;
T(m,n)= 2*T(m-1,n)+T(m,n-1)+T(m,n+1)+1500-9*T(m,n);
end
end
for m=2:M-1; % all interior nodes
for n=2:N-1;
T(m,n) = 1/4*(T(m+1,n)+T(m-1,n)+T(m,n+1)+T(m,n-1));
end
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by