plz explain me the code which i m describe below.
1 次查看(过去 30 天)
显示 更早的评论
clear, close all;
BorderLength=100;
NodeAmount=250;
BeaconAmount=50;
UNAmount=NodeAmount-BeaconAmount;
R=60;
Dall=zeros(NodeAmount,NodeAmount);%Unknown electricity saving to beacon node distance initial matrix; Beacon Amount line of Node Amount rows
h=zeros(NodeAmount,NodeAmount);%Initial jumps the number zero; BeaconAmount line of Node Amount rows
x=zeros(2,UNAmount);%Node estimate coordinate initial matrix
%~~~Has Uniform Distribution in the square region the random topology~~~~
C=BorderLength.*rand(2,NodeAmount);% Has the logical number node coordinate
Sxy=[[1:NodeAmount];C];
Beacon=[Sxy(2,1:BeaconAmount);Sxy(3,1:BeaconAmount)];
UN=[Sxy(2,(BeaconAmount+1):NodeAmount);Sxy(3,(BeaconAmount+1):NodeAmount)];
%~~~~Draws the Node Distribution map~~~~
plot(Sxy(2,1:BeaconAmount),Sxy(3,1:BeaconAmount),'r*',Sxy(2,(BeaconAmount+1):NodeAmount),Sxy(3,(BeaconAmount+1):NodeAmount),'k.')
xlim([0,BorderLength]);
ylim([0,BorderLength]);
0 个评论
回答(1 个)
Youssef Khmou
2013-3-5
hi,this code is about wireless localization , the figure shows the nodes distribution in space delimited by "BorderLength" variable .
In you code, UN,R,Dall and h variables are never used ,and the code is already explained with comments so i think you need to to read a little a bit of theory .
You have to give the whole details of the code , because what is in reality operational in your code can be reduced into this :
L=100;
NodeAmount=250;
BeaconAmount=50;
C=L.*rand(2,NodeAmount);
figure,
plot(C(1,1:BeaconAmount),C(2,1:BeaconAmount),'r*',C(1, (BeaconAmount+1):NodeAmount),C(2,(BeaconAmount+1):NodeAmount),'k.')
xlim([0,L]);
ylim([0,L]); % THIS IS THE SAME AS THE CODE YOU PROVIDED .
So as a first idea red dots represent the located Sensors . but you have to check that out .
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!