How can we provide minimum distance i.e. 20 between each random generated node?
Mostrar comentarios más antiguos
No_of_clusters = 25
no_sensor_box = 8
for i=1:no_of_clusters
for j=1:no_sensor_box
Xloc(s)=randi([x_loc1(i)+1,x_loc2(i)-1],1,1);
Yloc(s)=randi(([y_loc1(i)+1,y_loc3(i)]-1),1,1);
s=s+1;
end
end
This code generates nodes at some random locations, but I want the minimum distance (i.e.=20) between two nodes that means the minimum distance between each node are not less than 20. How to provide minimum distance between two nodes in this?
1 comentario
Torsten
el 8 de Nov. de 2017
How is the distance between two nodes s1 and s2 defined ?
d(s1,s2) = sqrt((Xloc(s1)-Xloc(s2))^2+(Yloc(s1)-Yloc(s2))^2)
?
Best wishes
Torsten.
Respuesta aceptada
Más respuestas (1)
I think Jan Simon's answer will at least partially solve your problem:
Best wishes
Torsten.
1 comentario
SHUAB KHAN
el 9 de Nov. de 2017
Categorías
Más información sobre Numerical Integration and Differentiation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!