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

조회 수: 1 (최근 30일)
%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 CenterFile Exchange에서 Thermal Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by