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!