%Ax = b lin. e.r. megoldasa Jacobi-iteracioval
%Ax = b  ->  (D+L+U)x=b  -> Dx = -(L+U)x+b -> Dx = Tx+b -> x=inv(D)(Tx+b)
function x = Jacobi_it(A,b, maxiter)
D = diag(diag(A));     %az A diagonalis elemeibol osszeallitott diag. matrix
T = D-A;                     % T = -(L+U)= -(A-D)
x = zeros(size(b));    % csupa nulla elemu vektorbol inditjuk az iteraciot
for k = 1:maxiter,
    x = D\(T*x+b);
end
