A=[9 4 1;
1 6 0;
1 -2 -6];
C=[-17;
4;
14];
x=PointJacobi(A,C)
function x=PointJacobi(A,C)
xold=ones(size(C));
x=xold;
[n,n]=size(A);
residual=A*x-C;
while max(abs(residual)) > 1.0e-8
for i=1:n
sum=0.0;
for j=1:n
if j~=i
sum=sum-A(i,j)*xold(j);
end
end
x(i)=(sum+C(i))/A(i,i);
end
xold=x;
residual=A*x-C
end
end