% % Gauss_Seidel.m - a function that computes using SOR Method % an approximation xsol of % the solution of Ax=b for given % a nxn matrix A and a vector b and a starting % estimate x^(0) where xsol=x^(k) and % ||x^(k)-x^(k-1)||_inftol, k=k+1; if k>kmax, flagct=1; flag=1; disp('SOR Method does not converge in kmax iterations') end else xsol=xv(:,k+1); flagct=1; flag=0; k=k-1; disp('SOR Method converges') end end