q=0;
x=zeros(N,1);
X=zeros(N,1);
while q<2000
for n=1:N
if n==1
X(n,1)=abs(b(n,1))-A(n,n+1:N)*x(n+1:N,1);
else if n<N
X(n,1)=abs(b(n,1))-(A(n,1:n-1)*X(1:n-1,1)+A(n,n+1:N)*x(n+1:N,1));
else n==N
X(n,1)=abs(b(n,1))-A(n,1:n-1)*X(1:n-1,1);
end
end
X(n,1)=max(X(n,1),0);
end
x=X;
q=q+1;
end