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

14 次查看(过去 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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Heat and Mass Transfer 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by