how to find Shortest path from source to destination in wireless sensor networks using matlab?
Mostra commenti meno recenti
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 Commenti
Lakshmipriya M
il 8 Mar 2017
same doubt for above question kindly pls answer for this anyone
Tagore Pattela
il 9 Set 2022
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)
Risposta accettata
Più risposte (2)
Matt J
il 16 Set 2014
0 voti
Junaid Qadir
il 24 Mar 2018
0 voti
You can use the Euclidean distance formula to find the nearest neighbor node.
1 Commento
Walter Roberson
il 24 Mar 2018
This is not sufficient to find shortest path on a network that forwards packets to nodes.
Categorie
Scopri di più su Dijkstra algorithm in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!