Trying to plot a temperature distribution and generate a temperature contourn!

78 ビュー (過去 30 日間)
Good night t all! I'm trying to plot the temperature distribution of a problem of 2 dimensional heat transfer on a thin plate, where the four borders have known temperature. The plate have L = 1m and W = 1m. I'm not allowed to use finite differences, so I have to plot a temperature contourn from the following temperature distribution equation
But I am lost. This is the code I've being using so far, but the graph I have generate looks nothing like a temperature distribution. I'm using a plate with 25 nodes. I need help!
X = 5;
Y = 5;
theta1 = zeros (X,Y);
for n =1:100
for X1 = 1:X
for Y1 = 1:Y
theta1(X1,Y1)=(2/pi)*(((-1)^(n+1)+1)/(n))*sin(n*pi*X1/L)*(sinh(n*pi*Y1/L))/(sinh(n*pi*W/L));
end
end
end
theta1sum = sum(theta1);
surf(1:5,1:5,theta1)

採用された回答

Akira Agata
Akira Agata 2022 年 8 月 15 日
How about the following?
L = 1;
W = 1;
[xGrid, yGrid] = meshgrid(0:0.025:1, 0:0.025:1);
T = zeros(size(xGrid));
for n = 1:100
T = T + (((-1)^(n+1)+1)/n).*sin(n*pi*xGrid/L).*...
(sinh(n*pi*yGrid/L)./sinh(n*pi*W/L));
end
T = T*(2/pi);
figure
surf(xGrid, yGrid, T)
xlabel("X", "FontSize", 12)
ylabel("Y", "FontSize", 12)
zlabel("T", "FontSize", 12)
  1 件のコメント
Torsten
Torsten 2022 年 8 月 15 日
@Lucas Resende comment moved here:
It worked perfectly! Thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by