フィルターのクリア

I want to elect an "Area-header" of the 4*4 cell-grid wsn structure , which would be at the center of the whole area. Their would be only one "Area-header" in the whole network which will track the position of the "mobile-sink" . I have used the foll

2 ビュー (過去 30 日間)
I want to elect an "Area-header" of the 4*4 cell-grid wsn structure , which would be at the center of the whole area. Their would be only one "Area-header" in the whole network which will track the position of the "mobile-sink" . I have used the following code to create a wsn structure with 4*4 cell grids and have deployed randomly 100 nodes in it and a "mobile sink" being introduced outside the boundary the wsn structure. Now how this "Area-header" will be introduced to track the position of the "mobile-sink"? Please help.
% WSN Grid structure with 4*4 cells made
NrGrid = 4;
x = linspace(0, 100, NrGrid+1);
[X,Y] = meshgrid(x);
figure(1)
plot(X,Y,'k')
hold on
plot(Y,X,'k')
hold off
set(gca, 'Box','off', 'XTick',[], 'YTick',[])
axis square
% grid formation ends
% Nodes deployment started
NrGrid = 4;
coords = rand(100,2) * NrGrid + 1;
scatter(coords(:,1),coords(:,2));
set(gca, 'XTick', 1:NrGrid+1, 'YTick', 1:NrGrid+1)
grid on
% Nodes deployment ends
%cluster head selection on basis of most near to the center
[XC, YC] = ndgrid(1/2:NrGrid+1/2, 1/2:NrGrid+1/2);
center_idx = zeros(NrGrid, NrGrid);
k=16;
for K = 1 : numel(XC)
xc = XC(K);
yc = YC(K);
dists = sqrt((coords(:,1)-xc).^2 + (coords(:,2)-yc).^2);
[mindist, minidx] = min(dists);
center_idx(k) = minidx;
end
%cluster head selection ends
energy(1:100) = sqrt(7) /2E7; % Energy given to all the nodes around 0.5 joules
%Mobile sink introduced
while true
sink_coords = randn(1,2) * NrGrid + NrGrid/2;
if sink_coords(1) < 1 | sink_coords(1) > NrGrid + 1 | sink_coords(2) < 1 | sink_coords(2) > NrGrid + 1
break
end
end
  1 件のコメント
Walter Roberson
Walter Roberson 2015 年 6 月 13 日
Insufficient information about what it means for the area header to "track" the sink.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeWSNs についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by