P=[3/2 1 0; -1 3/2 0; 1 -1 3/2]; x0=[1 1 1]; b=[1 1 1]; NN=10000; TOL=10^(-15); n=3; k=1; while k<=NN for i=1:n s=P(i,[1:n])*x0([1:n])'; x(i)=[s+b(i)]/2; end if norm(x-x0)NN fprintf('Maximum number of iterations exceeded\n') x=NaN; end k x