Here's a fun problem to look at requiring Matlab programming. *
Many applications require us to know the temperature distribution in an object. For example, this information is important for controlling the material properties such as hardness, when cooling an object formed from molten metal. The following is a derivation of the temperature distribution in a flat rectangular metal plate. The temperature on three sides is held constant at T1, and at T2 on the fourth side. The temperature T(x,y) as a function of xy coordinates is given by
T(x,y) = (T2-T1)w(x,y)+T1
where
w(x,y)=(2/pi)*sum(((2/n)*sin((n*pi*x)/L)))*((sin((n*pi*y)/L)/(sin((n*pi*w)/L))));
The given data for the problem is as follows: T1=70*F, T2 = 200*F, w=L= 2ft.
Using a spacing of 0.2 for both x and y let's generate a mesh plot and contour plot of the temperature distribution. Here is the code I wrote to try and solve the problem:
clear
clf
[x,y]=meshgrid(0:.2:2, 0:.2:2);
w=2;
L=2;
T1=70;
T2=200;
for n=1;
wa=(2./pi).*((2./n).*sin((n.*pi.*x)./L)).*((sinh((n.*pi.*y)./L)./(sinh((n.*pi.*w)./L))));
end
for n=[1,3,5];
wb=(2./pi).*((2./n).*sin((n.*pi.*x)./L)).*((sinh((n.*pi.*y)./L)./(sinh((n.*pi.*w)./L))));
end
for n=1:2:99
wc=(2./pi).*((2./n).*sin((n.*pi.*x)./L)).*((sinh((n.*pi.*y)./L)./(sinh((n.*pi.*w)./L))));
end
%Fig 1
Ta=(T2-T1).*wa+T1;
subplot(1,2,1)
meshc(x,y,Ta)
subplot(1,2,2)
contour(x,y,Ta)
%Fig 2
Tb=(T2-T1).*wb+T1;
subplot(1,2,1)
meshc(x,y,Tb)
subplot(1,2,2)
contour(x,y,Tb)
%Fig 3
Tc=(T2-T1).*wc+T1;
subplot(1,2,1)
meshc(x,y,Tc)
subplot(1,2,2)
contour(x,y,Tc)
print -deps Palm5p56fig.eps
I tried to export my figure out of Matlab for you to include in here but couldn't quite figure it out. Just run the code yourself and you'll get it though.
Enjoy!
*Adapted from Introduction to Matlab Programming for Engineers 7 by William Palm (pg 356)
Many applications require us to know the temperature distribution in an object. For example, this information is important for controlling the material properties such as hardness, when cooling an object formed from molten metal. The following is a derivation of the temperature distribution in a flat rectangular metal plate. The temperature on three sides is held constant at T1, and at T2 on the fourth side. The temperature T(x,y) as a function of xy coordinates is given by
T(x,y) = (T2-T1)w(x,y)+T1
where
w(x,y)=(2/pi)*sum(((2/n)*sin((n*pi*x)/L)))*((sin((n*pi*y)/L)/(sin((n*pi*w)/L))));
The given data for the problem is as follows: T1=70*F, T2 = 200*F, w=L= 2ft.
Using a spacing of 0.2 for both x and y let's generate a mesh plot and contour plot of the temperature distribution. Here is the code I wrote to try and solve the problem:
clear
clf
[x,y]=meshgrid(0:.2:2, 0:.2:2);
w=2;
L=2;
T1=70;
T2=200;
for n=1;
wa=(2./pi).*((2./n).*sin((n.*pi.*x)./L)).*((sinh((n.*pi.*y)./L)./(sinh((n.*pi.*w)./L))));
end
for n=[1,3,5];
wb=(2./pi).*((2./n).*sin((n.*pi.*x)./L)).*((sinh((n.*pi.*y)./L)./(sinh((n.*pi.*w)./L))));
end
for n=1:2:99
wc=(2./pi).*((2./n).*sin((n.*pi.*x)./L)).*((sinh((n.*pi.*y)./L)./(sinh((n.*pi.*w)./L))));
end
%Fig 1
Ta=(T2-T1).*wa+T1;
subplot(1,2,1)
meshc(x,y,Ta)
subplot(1,2,2)
contour(x,y,Ta)
%Fig 2
Tb=(T2-T1).*wb+T1;
subplot(1,2,1)
meshc(x,y,Tb)
subplot(1,2,2)
contour(x,y,Tb)
%Fig 3
Tc=(T2-T1).*wc+T1;
subplot(1,2,1)
meshc(x,y,Tc)
subplot(1,2,2)
contour(x,y,Tc)
print -deps Palm5p56fig.eps
I tried to export my figure out of Matlab for you to include in here but couldn't quite figure it out. Just run the code yourself and you'll get it though.
Enjoy!
*Adapted from Introduction to Matlab Programming for Engineers 7 by William Palm (pg 356)
No comments:
Post a Comment