// Resuelve Ax=b usando el metodo Jacobi
A=[10 -1 2 0; -1 11 -1 3; 2 -1 10 -1; 0 3 -1 8]
b=[6; 25; -11; 15]
N = 4;
x=zeros(N,1);
xt=zeros(N,1);
eps = 1e-6;
iter = 100;


for it = 1: iter
   for i = 1: N
      sum = 0.0;
      for j = 1: N
         if i == j then
            continue;
         end
         sum = sum + A(i,j) * xt(j);
      end
      if A(i,i) == 0.0 then
         exit(1);
      end
      xt(i) = (b(i) - sum) / A(i,i);
   end
   xt
   sw = 0;
   for i = 1: N
      if abs(x(i) - xt(i)) >= eps then
         sw = 1;
      end
      x(i)=xt(i);
   end
   if sw == 0 then
      break;
   end
end
it
x

