0001
0002
0003
0004
0005
0006 function w=fin02(xl,xr,yb,yt,z,M,N)
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 P = 5;
0016 H = 0.005;
0017 K = 1.68;
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+(j-1)*m) = -3/(2*k)+(H/K);
0032 A(i+(j-1)*m,i+(j+1-1)*m) = 2/k;
0033 A(i+(j-1)*m,i+(j+2-1)*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-1-1)*m) = 2/k;
0038 A(i+(j-1)*m,i+(j-2-1)*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 < n/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 v=A\b;
0058 w=reshape(v(1:mn),m,n);
0059 w=w+20;
0060 T=max(max(w));
0061 figure(2);
0062 mesh(x,y,w');
0063 title(['Cooling Fin - Max Temp=' num2str(T,4) ' Power (W)=' num2str(P)]);
0064 zlabel('Temperature (C)');
0065 ylabel('Fin Length (cm)');
0066 xlabel('Fin Length (cm)');