
%  M=load_corr('p1.mat');
%M = [	% matice ktera obsahuje 6 bodu - moznost pocitani odchylky
%
%   40.6452   39.9194  144.4355  145.8871   96.5323   68.9516,
%  211.8287   90.6801  184.2620   50.0554   86.3275  272.7657,
%  243.8710  238.7903  344.7581  344.7581  291.7742  273.6290,
%  203.1234   88.5038  177.0076   37.7229   80.5239  265.5113]

M = [
   57.3387 16.6935  147.3387   68.9516,
  55.8589 232.1411   50.0554  275.6675,
  253.3065 221.3710  345.4839  275.0806,
   52.2317 223.4358   38.4484  266.9622];

 
n=size (M,2);
for j=1:n
   % liche
A( 2*j-1,1)=M(1,j);
A( 2*j-1,2)= M(2,j);
A( 2*j-1,3) = 1;

A( 2*j-1,4) = 0;
A( 2*j-1,5) = 0;
A( 2*j-1,6) = 0;

A(2*j-1,7) = -M(3,j)*M (1,j);
A(2*j-1,8) = -M(3,j)*M (2,j);
A(2*j-1,9) = -M(3,j);
% sude

A( 2*j,1) = 0;
A( 2*j,2) = 0;
A( 2*j,3) = 0;

A( 2*j,4) = M(1,j);
A( 2*j,5) = M(2,j);
A( 2*j,6) = 1;

A(2*j,7) = -M(4,j)*M (1,j);
A(2*j,8) = -M(4,j)*M (2,j);
A(2*j,9) = -M(4,j);
end

[S,X,V]=svd(A);
H=V(:,end); % Ziskani matice H z posledniho sloupce
HH = (reshape(H,3,3))';

% POK=HH*[95.6254 88.0638 1]'; %testovani
% POK=HH*[ 68.9516 272.7657 1]';
% POK'/POK(3)'
% POK=HH*[ 96.5323 86.3275 1]';
% POK'/POK(3)'

