plz explain me the code which i m describe below.

조회 수: 1 (최근 30일)
glory pachnanda
glory pachnanda 2013년 3월 5일
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]);

답변 (1개)

Youssef  Khmou
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 .

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by