You are on page 1of 1

k=200;

Nx=10;
h=1/Nx;
alpha=2.28*1e-4;
r=alpha*k/h^2
t(:,1)=200;
a=zeros(Nx-1,Nx-1);
a=(1+2*r)*diag(ones(Nx-1,1))-r*diag(ones(Nx-2,1),1)-r*diag(ones(Nx-2,1),-1)
b=zeros(Nx-1,1);
b(Nx-1)=200*r
epsilon=1e-3;
itmax=100;
it=0;
told=zeros(Nx-1,1);
told(:)=200;
t=told;
R=1;
while(R>epsilon)&&(it<itmax)
it=it+1;
t=a\(told+b);
R=norm(t-told);
told=t;
hold on
plot(t);
grid on
end
dont be so proud of it u are all shit...that should be flashed from earth

You might also like