0001
0002
0003
0004
0005
0006 function [w,T]=fin07(xl,xr,yb,yt,z,M,N,P,K,H,offl,offr)
0007 m = M+1; n = N+1; mn = m*n;
0008 h=(xr-xl)/M; h2=h^2;
0009 k=(yt-yb)/N; k2=k^2;
0010 x=xl+(0:M)*h;
0011 y=yb+(0:N)*k;
0012 A=zeros(mn,mn);
0013 b=zeros(mn,1);
0014 L = 2;
0015
0016
0017
0018 delta = z;
0019 for i=2:m-1,
0020 for j=2:n-1,
0021 A(i+(j-1)*m,i-1+(j-1)*m)=1/h2;
0022 A(i+(j-1)*m,i+1+(j-1)*m)=1/h2;
0023 A(i+(j-1)*m,i+(j-1)*m)=-2/h2-2/k2-((2*H)/(K*delta));
0024 A(i+(j-1)*m,i+(j-2)*m)=1/k2;
0025 A(i+(j-1)*m,i+j*m)=1/k2;
0026 b(i+(j-1)*m)=0;
0027 end
0028 end
0029 for i=1:m
0030 j=1;
0031 A(i+(j-1)*m,i) = -3/(2*k)+(H/K);
0032 A(i+(j-1)*m,i+1*m) = 2/k;
0033 A(i+(j-1)*m,i+2*m) = -1/(2*k);
0034 b(i+(j-1)*m)=0;
0035 j = n;
0036 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*k)+(H/K);
0037 A(i+(j-1)*m,i+(j-2)*m) = 2/k;
0038 A(i+(j-1)*m,i+(j-3)*m) = -1/(2*k);
0039 b(i+(j-1)*m)=0;
0040 end
0041 for j=2:n-1
0042 i=1;
0043 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*h)+(H/K);
0044 A(i+(j-1)*m,i+1+(j-1)*m) = 2/h;
0045 A(i+(j-1)*m,i+2+(j-1)*m) = -1/(2*h);
0046 if j < ceil((n+1)/2),
0047 b(i+(j-1)*m)= -P/(L*K*delta);
0048 else
0049 b(i+(j-1)*m)= 0;
0050 end
0051 i = m;
0052 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*h)+(H/K);
0053 A(i+(j-1)*m,i-1+(j-1)*m) = 2/h;
0054 A(i+(j-1)*m,i-2+(j-1)*m) = -1/(2*h);
0055 b(i+(j-1)*m)=0;
0056 end
0057
0058
0059
0060
0061 for i = floor(offl*m):floor(offr*m),
0062 for j = floor(0.75*n):n,
0063 A(i+(j-1)*m,i-1+(j-1)*m)=0;
0064 A(i+(j-1)*m,i+1+(j-1)*m)=0;
0065 A(i+(j-1)*m,i+(j-1)*m)=0;
0066 A(i+(j-1)*m,i+(j-2)*m)=0;
0067 A(i+(j-1)*m,i+j*m)=0;
0068 b(i+(j-1)*m)=0;
0069 end
0070 end
0071
0072
0073
0074 for j = floor(0.75*n):n,
0075 i = ceil(offl*m);
0076 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*h)+(H/K);
0077 A(i+(j-1)*m,i-1+(j-1)*m) = 2/h;
0078 A(i+(j-1)*m,i-2+(j-1)*m) = -1/(2*h);
0079 end
0080
0081 for i = floor(offl*m):floor(offr*m),
0082
0083 j = n;
0084 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*k)+(H/K);
0085 A(i+(j-1)*m,i+(j-2)*m) = 2/k;
0086 A(i+(j-1)*m,i+(j-3)*m) = -1/(2*k);
0087 end
0088 v=A\b;
0089 w=reshape(v(1:mn),m,n);
0090 w=w+20;
0091 T=max(max(w));
0092 figure(2);
0093 mesh(x,y,w');
0094 view(180,0);
0095 title(['Cooling Fin - ' num2str(P,4) ' Watts (RIGHT)']);
0096 zlabel('Temperature (C)');
0097 xlabel('Fin Length (cm)');
0098 ylabel('Fin Length (cm)');
0099 figure(4);
0100 mesh(x,y,w');
0101 view(0,90);
0102 title(['Cooling Fin - ' num2str(P,4) ' Watts (TOP)']);
0103 xlabel('Fin Length (cm)');
0104 ylabel('Fin Length (cm)');