(
       )
  
  
  
  
  
  
  
  
  
      
  
  
      
  
  
      
      
  
  
  
  
  
  
  
  
  
  
   -
  
  
  
  
  
  
      
  

 
 
 


a=1.1;
b=1.8; d=2.5; l=2; h=0.05;
s=0.16666;
n=1/h+1;
x=0:h:1;
c1=(4/l^2)*(-d+(a+b)/2);
c2=(2/l)*(2*d-(3*a+b)/2);
u=c1*x.^2+c2*x+a*ones(1,n);
v=u;
u0=u;
m=25;
for j=1:m,
            for i=2:(n-1),
                        v(i)=u(i)+s*(u(i-1)-2*u(i)+u(i+1));
            end;
            u=v;
end;
u1=u;
for j=1:125,
            for i=2:(n-1),
                        v(i)=u(i)+s*(u(i-1)-2*u(i)+u(i+1));
            end;
            u=v;
end;
u2=u;
for j=1:100,
            for i=2:(n-1),
                        v(i)=u(i)+s*(u(i-1)-2*u(i)+u(i+1));
            end;
            u=v;
end;
u3=u;
for j=1:250,
            for i=2:(n-1),
                        v(i)=u(i)+s*(u(i-1)-2*u(i)+u(i+1));
            end;
            u=v;
end;
u4=u;
plot(x,u0,x,u1,x,u3,x,u4)
grid
prtsc
m1=25;m2=100;m3=500;
a=1.1;
b=1.8; d=2.5; l=2; h=0.05;
s=0.16666;
n=1/h+1;
f=ones(1,n);
alpha=f; beta=f;
alpha(1)=0;
beta(1)=a;
A(1)=1;
B(1)=1; C(1)=1;
A(n)=1;
B(n)=1; C(n)=1;
x=0:h:1;
c1=(4/l^2)*(-d+(a+b)/2);
c2=(2/l)*(2*d-(3*a+b)/2);
u=c1*x.^2+c2*x+a*ones(1,n);
v=(-1/s)*u;u0=u;
for
j=1:m3,
for i=2:(n-1),
A(i)=1; B(i)=-(2+1/s); C(i)=1;
alpha(i)=-1/(alpha(i-1)+b(i));
beta(i)=(v(i)-beta(i-1))/(alpha(i-1)+B(i));
v(i)=u(i)+s*(u(i-1)-2*u(i)+u(i+1));
end;
for i=(n-1):-1:2,
u(i)=alpha(i)*u(i+1)+beta(i);
end;
v=(-1/s)*u;
if (j==1), plot(x,u); end;
if (j==m1), u1=u; end;
if (j==m2), u2=u; end;
if (j==m3), u3=u; end;
end;
plot(x,u0,x,u1,x,u3)
xlabel('X');ylabel('U(x,t)');
title('
N3');
grid
prtsc

2011