• 大小: 457KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-01-07
  • 语言: Matlab
  • 标签: Matlab  WSN  定位  

资源简介

本文对无线传感器网络中不同的定位算法对定位误差的影响进行了研究比较。采用的定位算法有:基于测距的RSSI-MLE,RSSI-BP,RSSI-RBF和距离无关的HOP-BP,HOP-RBF,VN-BP,VN-RBF七种定位算法。在相同的仿真条件下,利用Matlab对这七种定位算法进行仿真研究。

资源截图

代码片段和文件信息

%% basic information
clear;clc;
l=100;
r=20;

ann=200;
anp=rand(2ann).*l;

bnn=10;
bnp=anp(:1:bnn);

testn=10;
testnp=anp(:(bnn+1):(bnn+testn));

unn=ann-bnn;
unp=anp(:(bnn+1):ann);

all_hop_table=zeros(ann);
all_dis_table=zeros(ann);

plot(anp(11:bnn)anp(21:bnn)‘ro‘anp(1(bnn+1):ann)anp(2(bnn+1):ann)‘b*‘);

%% all hop&distance table
for ii=1:ann
    for jj=1:ann
        if ii~=jj
          all_dis_table(iijj)=norm(anp(:ii)-anp(:jj)2);
            if all_dis_table(iijj)<=r
                all_hop_table(iijj)=1;
                all_hop_table(jjii)=1;               
            end
        end
    end
end

for ii=1:ann
    for jj=1:ann
        if ii~=jj
            if all_hop_table(iijj)~=0 
                for kk=1:ann
                    if kk~=ii
                      if all_hop_table(jjkk)~=0
                          if all_hop_table(iikk)==0
                          all_hop_table(iikk)=all_hop_table(jjkk)+all_hop_table(iijj);
                          all_hop_table(kkii)=all_hop_table(iikk);
                          end
                          
                          if all_hop_table(iikk)~=0
                            if all_hop_table(iikk)>all_hop_table(jjkk)+all_hop_table(iijj)
                             all_hop_table(iikk)=all_hop_table(jjkk)+all_hop_table(iijj);
                             all_hop_table(kkii)=all_hop_table(iikk);
                            end
                         end
                     end
                  end
              end
          end
      end
end
end

%% save the data
gall_hop_table=all_hop_table/10;

bhop_table=gall_hop_table(1:bnn1:bnn);
thop_table=gall_hop_table(1:bnn(bnn+1):(bnn+testn));
uhop_table=gall_hop_table(1:bnn(bnn+1):ann);

save allrelation_1;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1846  2010-05-12 15:52  vn-bp\allrelation_1.m

     文件     352569  2010-05-12 15:52  vn-bp\allrelation_1.mat

     文件        889  2010-05-12 15:57  vn-bp\mylocalnet1.m

     文件      16663  2010-05-12 15:58  vn-bp\mylocalnet1.mat

     文件        877  2010-05-12 21:07  vn-bp\mylocalnet2.asv

     文件        877  2010-05-12 21:10  vn-bp\mylocalnet2.m

     文件      33779  2010-05-12 20:59  vn-bp\mylocalnet2.mat

     文件        369  2010-05-12 16:05  vn-bp\net1_out.asv

     文件        405  2010-05-12 17:44  vn-bp\net1_out.m

     文件        406  2010-05-12 21:08  vn-bp\net2_out.m

     文件       2748  2010-05-12 17:52  vn-bp\newnodes.m

     文件       1757  2010-05-12 19:14  vn-bp\new_allrelation.m

     文件      53187  2010-05-12 19:14  vn-bp\new_allrelation.mat

     文件       3178  2010-05-12 17:52  vn-bp\new_anp.mat

     文件        178  2010-05-12 17:52  vn-bp\new_bnn.mat

     文件        425  2010-05-12 17:52  vn-bp\new_bnp.mat

     文件        178  2010-05-12 17:52  vn-bp\new_unn.mat

     文件       2948  2010-05-12 17:52  vn-bp\new_unp.mat

     文件       2343  2010-05-12 17:51  vn-bp\x1_out.mat

     目录          0  2010-10-01 21:02  vn-bp

----------- ---------  ---------- -----  ----

               475622                    20


评论

共有 条评论