Project - Traveling salesman problem
PROJECT1:
% Creating X co ordinates By Using Rand Function:
x=randi(100,1,20);
x
x =
36 84 59 55 92 29 76 76 39 57 8 6 54 78 94 13 57 47 2 34
% Creating Y co ordinates By Using Rand Function:
y=randi(100,1,20);
y
y =
17 80 32 53 17 61 27 66 69 75 46 9 23 92 16 83 54 100 8 45
% Plotting & labelling The Graph as Required:
plot(x,y,'o');
xlabel('x-distance from the city center (km)');ylabel('y-distance from the city center (km)');
title('x-y plot designation station to visit');
% Finding The Center Of the Graph:
text(50,50,'c');
% Calculating The Distance of Each POint From Center And Plotting Into The Graph:
for i =1:20,
d(i)=round(sqrt(((50^2)-(x(i)^2))^2+((50^2)-(y(i)^2))^2)/100);
text(x(i),y(i),"d"+d(i));
end;

% Main Stream Function: