% zadanie 2
H_R = 1;
h = [1.04 2.05 3.03 ]';
A = [ 1 0; -1 1; 0 1; ];
L = [ -H_R ; 0 ; -H_R ] - h;

m = [2 ; 2 ; 4 ]/1e2; % [m]
P = diag(m.^(-2));    % [1/m^2]

X = -inv(A'*P*A)*(A'*P*L)
V = A*X + L

A'*P*V 
V'*P*V  
L'*P*A*X+L'*P*L

h_wyr = h + V
h_wyr_ze_wsp = [
  X(1)-H_R 
  X(2)-X(1) 
  X(2)-H_R
  ]

sigma_0 = sqrt((V'*P*V)/(size(A,1)-size(A,2))) % bez miana
