-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnodes1.m
26 lines (21 loc) · 871 Bytes
/
nodes1.m
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
function [pij, node_degree] = nodes1(cen1, neighbor_limit, alpha, Band, lamdamV, Thr)
% Calculate distance matrix
dij = dist(cen1');
% Initialize power matrix
pij = zeros(size(cen1, 1));
% Initialize node degree vector
node_degree = zeros(size(cen1, 1), 1);
% Loop over each station
for k = 1:size(cen1, 1)
% Calculate neighbors within range for each station
neighbors = find((dij(k, :) > 0) & (dij(k, :) <= neighbor_limit));
% Update node degree
node_degree(k) = length(neighbors);
% Calculate power for each neighbor
for neighbor_idx = 1:length(neighbors)
neighbor = neighbors(neighbor_idx);
theta = theta1(cen1(k, :), cen1(neighbor, :));
pij(k, neighbor) = (dij(k, neighbor) ^ alpha) * theta;
end
end
end