clear;
format long g;
format compact;
disp('Predmet: MA6G;   Uloha 3: Vlastni cisla matic – Rayleighuv podil')
disp(' ')
% ============================================================================ %
A = [ 1    0  -1/4 -1/4
      0    2  -1/4 -1/4
    -1/4 -1/4   2    0
    -1/4 -1/4   0    1 ]
x = [ 1; 0; 0; 0 ]

maxi = 50;
eps = 1;
maxe = 10^-6;

for iterace = 0 : maxi
    if (abs(eps) < maxe)
        break
    end
    iterace
    lambda = (x'*A*x)/(x'*x)
    x = A*x;
    eps = det(A-lambda*eye(4))
    disp(' ')
end

VC_matlab = eig(A)