I am trying to solve a set of linear equations of heat transfer conduction using gauss seidel iteration, but my solutions seem not to correct compared to the exact or analytic solution.
조회 수: 2 (최근 30일)
이전 댓글 표시
this are the codes below.
clear all;
N=4; % Number of columns
M=4; % Number of rows
error_T=ones(4,4);
T_amb = 300;% initial emperatures in matrix
T=ones(4,4)*T_amb;% create 4x4 matrix with Tamb
T_old=zeros(4,4);
T(:,1)=100;% boundary condition at the left
T(:,4)=100;% boundary condition at the right
T(1,:)=500;% boundary condition at the top
T(4,:)=100;% boundary condition at the bottom
for m=2:M-1;
for n=2:N-1
% Calculcate temperature at
while error_T(m,n)>= 0.01
T_old=T(m,n);
T(m,n) = 1/4*(T(m+1,n)+T(m-1,n)+T(m,n+1)+T(m,n-1));
error_T(m,n)=abs((T(m,n)-T_old)/T(m,n))*100;
end
end
end
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!