plz explain me the code which i m describe below.

1 Ansicht (letzte 30 Tage)
glory pachnanda
glory pachnanda am 5 Mär. 2013
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]);

Antworten (1)

Youssef  Khmou
Youssef Khmou am 5 Mär. 2013
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 .

Kategorien

Mehr zu Random Number Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by