clear all

%Zadejte pozadovanou mapu:
%2D zhora R=1
%3D model R=2
R=1;

BodX=[200   ,300   ,150 ,200 , 250,   500,   200, 200, 332,   245,   120,   150,   200, 235, 390, 390,   450, 518,   400,   400, 499, 100,   200,   350, 290, 540, 420, 200, 300,   500,   250,   305,   350, 450, 365,480,   450, 405,   300];
BodY=[200   ,300   ,185 , 50 ,  50,   350,    75, 105, 100,   100,    70,   250,   350, 270, 380, 280,   200, 200,   440,    50, 150, 300,   300,   310, 380, 360, 335, 400, 450,   100,   135,   245,   150, 125, 265,240,   400, 215,   200];
Area=[1327.5,1129.5,1455,1524,1455,1029.5,1437.5,1381,1209,1301.5,1528.5,1527.5,1456.5,1261,1091,1041,1016.5,1004,1102.5,1273.5,1156,1852,1356.5,1084.5,1215,1102,1010,1523,1204,1196.5,1236.5,1135.5,1030.5,1079,1029,989,1018.5,1012,1134.5];
Area_lomeno1=1./Area;
Area_lomeno12=Area_lomeno1.*1000000;



x1=0;
y1=0;
x2=400;
y2=500;
x3=600;
y3=100;
Stanice1=[x1,y1];
Stanice2=[x2,y2];
Stanice3=[x3,y3];
B=[333.33,200];
C=[333.33,200];
A = [Stanice1; Stanice2 ; Stanice3];
if R==1
[xq,yq] = meshgrid(-100:1:600, -100:1:600);
vq = griddata(BodX,BodY,Area,xq,yq);
figure
hold on
grid on
colorbar
colormap(flipud(colormap))
p1=plot(A(:,1), A(:,2), '*');
 mesh(xq,yq,vq)
 p3=scatter3(333.33,200,2000,'MarkerFaceColor',[0 .75 .75]);
 plot(C(:,1), C(:,2), '*',-50,-50,630, 530)
p2=plot(B(:,1), B(:,2), '*','Color','r');
legend([p1,p3],'stanice','tìžištì','Location','northwest')
title(['Mapa pøesnosti urèení polohy'])
axis equal
else
    [xq,yq] = meshgrid(-100:10:600, -100:10:600);
vq = griddata(BodX,BodY,Area_lomeno12,xq,yq);
figure
hold on
grid on
colorbar
 mesh(xq,yq,vq)

title(['Mapa pøesnosti urèení polohy (z"=10^6/z)'])
axis tight
end
xlabel('poloha x [m]')
ylabel('poloha y [m]')
zlabel('poloha z" [m]')
