Effacer les filtres
Effacer les filtres

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

37 vues (au cours des 30 derniers jours)
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)

Réponse acceptée

Akira Agata
Akira Agata le 15 Août 2022
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)

Plus de réponses (0)

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by