核心提示:MATLAB代做-python代做-FPGA代做-未知节点利用邻居锚节点进行定位,没有邻居锚节点 …
function RSSI()
% 未知节点利用邻居锚节点进行定位,没有邻居锚节点的未知节点无法定位
% 根据接收信号强度转化为距离。规则传播模型下得到的距离跟实际距离没有误差
% 不规则通信模型下,规则传播模型下得到的距离跟实际距离存在误差
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
load ‘../Deploy Nodes/coordinates.mat’;
load ‘../Topology Of WSN/neighbor.mat’;
directory=cd;
cd ‘../Topology Of WSN/Transmission Model/’;
cd(model);
unknown_node_index=all_nodes.anchors_n+1:all_nodes.nodes_n;
for i=unknown_node_index
neighboring_anchor_index=intersect(find(neighbor_matrix(i,:)==1),find(all_nodes.anc_flag==1));%只利用邻居锚节点进行定位
neighboring_anchor_n=length(neighboring_anchor_index);
if neighboring_anchor_n>=3
try
dist=rss2dist(neighbor_rss(neighboring_anchor_index,i),1);
catch
dist=rss2dist(neighbor_rss(neighboring_anchor_index,i));
end
neighboring_anchor_location=all_nodes.estimated(neighboring_anchor_index,:);
%~~~~~~~~~~~~~~~~~~~~~~~~~三边测量法(最小二乘法)
A=2*(neighboring_anchor_location(1:neighboring_anchor_n-1,:)-repmat(neighboring_anchor_location(neighboring_anchor_n,:),neighboring_anchor_n-1,1));
neighboring_anchor_location_square=transpose(sum(transpose(neighboring_anchor_location.^2)));
dist_square=dist.^2;
b=neighboring_anchor_location_square(1:neighboring_anchor_n-1)-neighboring_anchor_location_square(neighboring_anchor_n)-dist_square(1:neighboring_anchor_n-1)+dist_square(neighboring_anchor_n);
all_nodes.estimated(i,:)=transpose(A\b);
all_nodes.anc_flag(i)=2;
end
end
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cd(directory);
save ‘../Localization Error/result.mat’ all_nodes comm_r;
end
联系:highspeedlogic
QQ :1224848052
微信:HuangL1121
邮箱:1224848052@qq.com
微信扫一扫:
今天的文章matlab中寻找邻居节点,MATLAB代做-python代做-FPGA代做-未知节点利用邻居锚节点进行定位,没有邻居锚节点…分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/32944.html