0001
0002
0003
0004
0005
0006
0007 function [w,T]=fin04(xl,xr,yb,yt,z,M,N,P)
0008 m=M+1; n=N+1; mn=m*n;
0009 h=(xr-xl)/M; h2=h^2;
0010 k=(yt-yb)/N; k2=k^2;
0011 x=xl+(0:M)*h;
0012 y=yb+(0:N)*k;
0013 A=zeros(mn,mn);
0014 b=zeros(mn,1);
0015 L = 2;
0016
0017 H = 0.005;
0018 K = 3.85;
0019 delta = z;
0020 for i=2:m-1,
0021 for j=2:n-1,
0022 A(i+(j-1)*m,i-1+(j-1)*m)=1/h2;
0023 A(i+(j-1)*m,i+1+(j-1)*m)=1/h2;
0024 A(i+(j-1)*m,i+(j-1)*m)=-2/h2-2/k2-((2*H)/(K*delta));
0025 A(i+(j-1)*m,i+(j-2)*m)=1/k2;
0026 A(i+(j-1)*m,i+j*m)=1/k2;
0027 b(i+(j-1)*m)=0;
0028 end
0029 end
0030 for i=1:m
0031 j=1;
0032 A(i+(j-1)*m,i) = -3/(2*k)+(H/K);
0033 A(i+(j-1)*m,i+j*m) = 2/k;
0034 A(i+(j-1)*m,i+(j+1)*m) = -1/(2*k);
0035 b(i+(j-1)*m)=0;
0036 j=n;
0037 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*k)+(H/K);
0038 A(i+(j-1)*m,i+(j-2)*m) = 2/k;
0039 A(i+(j-1)*m,i+(j-3)*m) = -1/(2*k);
0040 b(i+(j-1)*m)=0;
0041 end
0042 for j=2:n-1
0043 i=1;
0044 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*h)+(H/K);
0045 A(i+(j-1)*m,i+1+(j-1)*m) = 2/h;
0046 A(i+(j-1)*m,i+2+(j-1)*m) = -1/(2*h);
0047
0048 if j < n/2,
0049 b(i+(j-1)*m)= -P/(L*K*delta);
0050 else
0051 b(i+(j-1)*m)=0;
0052 end
0053
0054 i=m;
0055 A(i+(j-1)*m,i+(j-1)*m) = -3/(2*h)+(H/K);
0056 A(i+(j-1)*m,i-1+(j-1)*m) = 2/h;
0057 A(i+(j-1)*m,i-2+(j-1)*m) = -1/(2*h);
0058 b(i+(j-1)*m)=0;
0059 end
0060 v=A\b;
0061 w=reshape(v(1:mn),m,n);
0062 w=w+20;
0063 T = max(max(w));
0064
0065
0066