0001
0002
0003
0004
0005
0006 function [w,T]=fin06(xl,xr,yb,yt,z,M,N,P,K,H)
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+j*m) = 2/k;
0033 A(i+(j-1)*m,i+(j+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-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 b(i+(j-1)*m)= -P/(L*K*delta);
0047 i=m;
0048 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*h)+(H/K);
0049 A(i+(j-1)*m,i-1+(j-1)*m) = 2/h;
0050 A(i+(j-1)*m,i-2+(j-1)*m) = -1/(2*h);
0051 b(i+(j-1)*m)=0;
0052 end
0053 v=A\b;
0054 w=reshape(v(1:mn),m,n);
0055 w=w+20;
0056 T = max(max(w));
0057
0058
0059 ylabel('Heat Input (W)');