how to find Shortest path from source to destination in wireless sensor networks using matlab?
이전 댓글 표시
Among all the paths available from source to destination, I need to find the shortest path between source and destination....For example,in an area of 500*500 i have deployed 10 nodes randomly.considering 1st node as source and 10th node as destination now,I need matlab code for finding the optimized route from node1 to node10..can anyone please help??
댓글 수: 3
Lakshmipriya M
2017년 3월 8일
same doubt for above question kindly pls answer for this anyone
Tagore Pattela
2022년 9월 9일
did u have code for this answer
I described the process https://www.mathworks.com/matlabcentral/answers/155009-how-to-find-shortest-path-from-source-to-destination-in-wireless-sensor-networks-using-matlab#answer_311668
x = randi(500, 1, 10);
y = randi(500, 1, 10);
xy = [x; y].'
D = squareform(pdist(xy))
G = graph(D)
p = shortestpath(G, 1, 10)
Shortest path is just to go directly from the beginning to the end.
This will always be the case unless:
- you have range limitations; or
- you have blocked paths; or
- you have non-euclidean paths: due to reflections and different materials, direct paths might lead to traversing paths with slower signal transmission rates, and indirect paths might hypothetically travel routes that have higher signal transmission rates
%range limit
D(D > 250) = 0;
G1 = graph(D)
p = shortestpath(G1, 1, 10)
채택된 답변
추가 답변 (2개)
Matt J
2014년 9월 16일
0 개 추천
Junaid Qadir
2018년 3월 24일
0 개 추천
You can use the Euclidean distance formula to find the nearest neighbor node.
댓글 수: 1
Walter Roberson
2018년 3월 24일
This is not sufficient to find shortest path on a network that forwards packets to nodes.
카테고리
도움말 센터 및 File Exchange에서 Dijkstra algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!