MATLAB Answers

How to find minimum distance gateway node from a cluster head?

2 views (last 30 days)
Rohini Sharma
Rohini Sharma on 30 Apr 2015
Hello every body.
I have a sensor network of 100 sensor nodes. sink.x=50; sink.y=120;
for i = 1 : 1 :n
S(i).xd = rand(1,1)*xm ;
S(i).yd = rand (1,1)*ym ;
xd(i) = S(i).xd ;
yd(i) = S(i).yd ;
S(i).id = i;
S(i).type = 0;
S(i).g = 0 ;
S(i).E = Eo ;
S(i).type = 0 ;
% plot(S(i).xd, S(i).yd , 'o' )
% grid on ;
% hold on ;
% figure(1);
Next I have a set of 16 gateway nodes. Placed as follows
for i=1:1:16
Sg(i).xd= 2+100*rand(1,1);
grid on;
hold on;
I have to form cluster heads from these sensor nodes using LEACH protocol. After the creation of cluster heads, I have to connect a gateway node with every cluster head. Condition gateway node should be at minimum distance from cluster head.
Please reply.
I know LEACH code. But no able to connect gateway node with min distance CH.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by