필터 지우기
필터 지우기

How to find the nearest neighbors points in this case ?

조회 수: 1 (최근 30일)
Matlab111
Matlab111 2014년 12월 6일
답변: Rohini Sharma 2015년 4월 30일
just see this image 1 in this they where creating wsn(wireless sensor network). This i have done in matlab you can see my coding also i attached below.
Image-1
Image-2
in this image they are finding nearest sensor node gateway's, so now i want to find the sensor node nearest sensor node gateway's please help me..
  댓글 수: 4
Image Analyst
Image Analyst 2014년 12월 7일
I just blindly ran the code and it made this:
It doesn't look anything like your gateway and sensor node image with the blue and green spots above. Can you explain this plot? It's not explained in the code - the comments are very very minimal. And I don't see any image, just a plot or scatterplot.
Matlab111
Matlab111 2014년 12월 7일
sir, in this figure 'X' is denoted as gateway node and 'o' this denoted as normal sensor node's.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 12월 7일
So you don't have to start with an image. You have a list of (x,y) coordinates for gateways and sensors. So why can't you just run through the list with a for loop calculating the distance of each gateway to all the sensors, and select sensors that are closer than some specified distance? Just use the Pythagorean theorem and a double for loop. Draw lines to "close" pairs. Seems pretty easy.
  댓글 수: 6
Matlab111
Matlab111 2014년 12월 7일
sir what that "%15f %15f" indicates in "fprintf(' Sensor node: %15f %15f', x, y);"
Matlab111
Matlab111 2014년 12월 7일
ya sir i got it. Thank's a lot....

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Rohini Sharma
Rohini Sharma 2015년 4월 30일
Hello Arul and Image Analyst
How to modify the code in order to connect gateway node with only one sensor node? Here gateway node is connection to all sensor node with in its range=10.
Please reply Thanks

카테고리

Help CenterFile Exchange에서 WSNs에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by