At a guess you want:
Originally Posted by raed
though I would have to check that this did what I expect specially if there is some ambuigity about row and column vectors.
You will of course be better off going back to the definition of Jacobi iteration:
or using the fact that we know the inverse of a diagonal matrix:
d=diag(A,0); %extracts the principle diagonal of A as a vector
D=diag(d); %creates a diagonal matrix with d down the diagonal
R=A-D; %remainder matrix
X_new=inv(D)*(b-R*X_old); %Jacobi iteration
Matlab is a vector/matrix language, don't translate vector/matrix operations into elementwise scalar operations.