A = [0 0 0 1 0 1 0; 0 0 1 1 0 1 0; 0 1 0 0 0 0 0; 1 1 0 0 0 1 1; 0 0 0 0 0 1 0;
1 1 0 1 1 0 0; 0 0 0 1 0 0 0];
P = [11.9 50.3; 11.4 48.8; 11.5 48.2; 11.1 49.4; 13.3 48.6; 12.1 49.0; 9.9 49.8];
P(:,1)=P(:,1)*75;
P(:,2)=P(:,2)*111;
P
figure;set(gcf,'WindowStyle','docked')
gplot(A,P,'b');
hold on;
gplot(A,P,'or');
axis equal;
axis off;
text(5+P(1,1),P(1,2),'Hof');
text(5+P(2,1),P(2,2),'Ingolstadt');
text(5+P(3,1),P(3,2),'München');
text(5+P(4,1),P(4,2),'Nürnberg');
text(5+P(5,1),P(5,2),'Passau');
text(5+P(6,1),P(6,2),'Regensburg');
text(5+P(7,1),P(7,2),'Würzburg');
pause(5)
I = [0 0 0 1 0 0 1 0; 1 -1 0 0 0 -1 0 0; -1 0 0 0 0 0 0 0; 0 0 0 0 1 1 -1 -1;
0 0 -1 0 0 0 0 0; 0 1 1 -1 -1 0 0 0; 0 0 0 0 0 0 0 1];
[K L] = find(I);
J=[K(1:2:end)'; K(2:2:end)']
pause(3)
dx=P(J(1,:),1)-P(J(2,:),1);
dy=P(J(1,:),2)-P(J(2,:),2);
d=sqrt(dx.^2+dy.^2)
% Luftlinie eintragen mit sprintf und text
mx=(P(J(1,:),1)+P(J(2,:),1))/2;
my=(P(J(1,:),2)+P(J(2,:),2))/2;
S = [];
for n=1:8,
S=[S; sprintf('%3.0f km',d(n))];
end;
text(mx',my',S);
title('Luftlinien und Entfernungen');
hold off;