Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

clustering of sensor nodes

Status
Not open for further replies.

vidya.patil1990

Newbie level 1
Newbie level 1
Joined
May 23, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,291
Hey guys,
I am a post graduate student and I am working on wsn as a field of interest. I am a beginner so learning to code in Matlab.
Initially In my project i need to generate a sensor network (I have considered 50 nodes). cluster them uniformly(5 clusters ,with 10 sensor nodes including CH).
all CH's placed in the center .The code which im upto till now is not meeting my requirements.Can someone pls help me in doing this.. ?
clear;
xmax=100;
ymax=100;
n=50;
%Generation of sensor nodes
for i=1:1:n;
rand('state', 0);

XR=rand(1,n)*xmax; %structure array of x and y coordinates of a node and node id
YR=rand(1,n)*ymax;

if (XR(i)>25 && XR(i)<75 && YR(i)>25 && YR(i)<75)
N(i).level=0;


plot(XR(i),YR(i),'*r') %plot CHs in middle
text(XR(i),YR(i), num2str(i));


axis([0 100 0 100])

hold on; %to display all the CH in the area ranging from 25 to 75
else
N(i).level=1;

plot(XR(i),YR(i),'*g')
text(XR(i),YR(i), num2str(i));

axis([0 100 0 100])
end
end
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top