;
hold on;
%axis equal;
axis([0 1 0 1]);
for i=1:10;
x(i,:)=ginput(1);
text(x(i,1), x(i,2), '1');
plot(x(i,1), x(i,2), '.');
end;
for i=11:20;
x(i,:)=ginput(1);
text(x(i,1), x(i,2), '2');
plot(x(i,1), x(i,2), '.');
end;
for i=21:30;
x(i,:)=ginput(1);
text(x(i,1), x(i,2), '3');
plot(x(i,1), x(i,2), '.');
end;
for j=1:3;
display('please input new sample with mouse');
x1(j,:)=ginput(1);
for i=1:30; dx(i)=norm(x1(j,:)- x(i,:));end;
[xd,id] = min(dx);
switch floor(id/10-1e-3)+1
case 1
M = 1
case 2
M = 2
case 3
M = 3
otherwise
error('This is impossible')
end
switch j
case 1
s = 'A';
case 2
s = 'B';
case 3
s = 'C';
otherwise
error('This is impossible')
end
text(x1(j,1), x1(j,2), s)
plot([x1(j,1) x(id,1)],[x1(j,2) x(id,2)],'-');
end;اريد شرح هذا الكود سطر سطر علما بان هذا الكود لخوارزمية الجار الاقرب