How to find minimum distance gateway node from a cluster head?
2 次查看(过去 30 天)
显示 更早的评论
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);
end
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);
Sg(i).yd=100;
xd(i)=Sg(i).xd;
yd(i)=Sg(i).yd;
Sg(i).id=i;
plot(Sg(i).xd,Sg(i).yd,'*k')
grid on;
hold on;
end
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.
Thanks
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!