how to connect nearest neighbor node between source node to destination node
Show older comments

N=20;
area=100;
XX=area/2;
YY=area/2;
bs=[XX,YY];
X=rand(1,N)*area;
Y=rand(1,N)*area;
plot(XX,YY,':o','LineWidth',3,'MarkerEdgeColor','k','MarkerFaceColor',[0.5,0.5,0.5],'MarkerSize',15);
text(XX,YY,'BS');
hold on;
xlabel('X');
ylabel('Y');
X1=([X;Y])';
grid on;
for i=1:N
plot(X(i),Y(i));
text(X(i),Y(i),num2str(i),'fontsize',15);
end
now i wish to connect node 14 to 9 through nearest neighbor nodes
node 14 is source node connect with nearest node in direction destination node(9)
firstly 14 connect with 10
then 10 connect with 11
then 11 connect with BS
then BS connect with node 9
Accepted Answer
More Answers (0)
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!