1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
F=[ones(1,N), ones(1,N)]% F est l'ensemble des cordonnées des nuds
for i=1:N
F(1,i)=node(i).x
F(2,i)=node(i).y
end
for i=1:N
for j=1:countCHs
pointer(1,j)=X(j)
pointer(2,j)=Y(j)
% pointer(j, 3)=C(j).id
end
end
MM =
Columns 1 through 9
0 9.4229 59.8524 47.0924 69.5949 69.9888 63.8531 3.3604 6.8806
0 0.1151 46.2449 42.4349 46.0916 77.0160 32.2472 78.4739 47.1357
Columns 10 through 18
31.9600 53.0864 65.4446 40.7619 81.9981 71.8359 96.8649 53.1334 32.5146
3.5763 17.5874 72.1758 47.3486 15.2721 34.1125 60.7389 19.1745 73.8427
Columns 19 through 27
10.5629 0 77.8802 0 9.0823 26.6471 15.3657 28.1005 44.0085
24.2850 0 26.9062 0 18.8662 28.7498 9.1113 57.6209 68.3363
Columns 28 through 36
52.7143 45.7424 87.5372 51.8052 94.3623 63.7709 95.7694 24.0707 67.6122
54.6593 42.5729 64.4443 64.7618 67.9017 63.5787 94.5174 20.8935 70.9282
Columns 37 through 45
28.9065 67.1808 69.5140 6.7993 25.4790 22.4040 66.7833 84.4392 34.4462
23.6231 11.9396 60.7304 45.0138 45.8725 66.1945 77.0286 35.0218 66.2010
Column 46
78.0520
41.6159
% Calculate the 5 nearest neighbours to P, specifying that they must be
% at most 0.2 away by Euclidean distance
I = nearestneighbour(pointer, MM,'NumberOfNeighbours', 5)
nn = length(I)
[v cc]=size(MM);%% v=2 ;cc=45
Ix=[ones(5,nl)] % Ix et Iy pour récupérer les coordonnées des nuds proches de chaque cluster head à partir de leurs indices contenus dans I
Iy=[ones(5,nl)] %
for j=1:nl
for i=1:5
for k=1:cc
if node(k).id == I(i,j)
Ix(i,j)=node(k).x
Iy(i,j)=node(k).y
end
end
end
end |
Partager