👨🎓个人主页:研学社的博客
💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
📚2 运行结果
🎉3 参考文献
🌈4 Matlab代码实现
💥1 概述
1。创建具有中间节点以及静态源节点和接收器节点的 WSN 模型
2.在中间节点
3 中应用基本 RWM。
4.评估结果
📚2 运行结果
部分代码:
function [r_path, r_cost] = DjisktraRoute(pathS, pathE, transmat)
noOfNode = size(transmat, 1);
for i = 1:noOfNode
parent(i) = 0;
distance(i) = inf;
end
queue = [];
% Start from pathS
for i=1:noOfNode
if transmat(pathS, i)~=inf
distance(i) = transmat(pathS, i);
parent(i) = pathS;
queue = [queue i];
end
end
% Width-first exploring the whole graph
while length(queue) ~= 0
hopS = queue(1);
queue = queue(2:end);
for hopE = 1:noOfNode
if distance(hopE) > (distance(hopS) + transmat(hopS,hopE))
distance(hopE) = distance(hopS) + transmat(hopS,hopE);
parent(hopE) = hopS;
queue = [queue hopE];
end
end
end
distance ;
parent ;
% Back-trace the shortest-path
r_path = [pathE];
i = parent(pathE);
while i~=pathS && i~=0
r_path = [i r_path];
i = parent(i) ;
end
if i==pathS
r_path = [i r_path];
else
r_path = [];
end
% Return cost
r_cost = distance(pathE);
🎉3 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]Amburose Sekar (2022). Random Way Mobility with Routing WSN simulator