Trying to plot a temperature distribution and generate a temperature contourn!
11 次查看(过去 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1098060/image.png)
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)
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!