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

2 views (last 30 days)
%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

Answers (0)

Categories

Find more on Thermal Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!