How to give number to the node randomly
조회 수: 1 (최근 30일)
이전 댓글 표시
I placed 50 random node in the area of 180*40.
Now how to give number to that random node from 1-50 and also how to calculate the coordinates of each random node.
댓글 수: 4
Jan
2018년 12월 9일
I do not understand the question. What does "give number" mean? If you have placed the "nodes" (what ever this means) already, you do have the corrdinates. So what do you want to calculate?
채택된 답변
Image Analyst
2018년 12월 9일
Since each point is a random number, there is no need to shuffle/randomize their indexes in the x and y array afterwards. If you think there is for some reason, then tell us the reason why x and y will need to be randomly shuffled with randperm:
x = x(randperm(length(x)));
y = y(randperm(length(y)));
It's not clear why you need to do this.
댓글 수: 7
Image Analyst
2018년 12월 9일
I don't know what relay nodes and sink nodes are. Sorry, but I don't have time to delve into your project and co-develop it with you. I hope by seeing how I computed distances, and found nearby ones and the closest ones, you can adapt it as needed. It really shouldn't be that hard. Good luck.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!