function [x,tolc,NIT]=Jacobi(A,b,tol,m)
n=size(A,1);
x0=randn(n,1);
D=diag(diag(A));
L=(D-A);
for k=1:m
	x=L*x0+b;
	x=D\x;
	NIT=k;
	tolc=norm(x-x0);
	x0=x;
	if tolc<=tol,break;end
end