1 year ago
#179177
omar aljubory
Can we assign the users that located within the range of blue stars and black dot?
Is there a way to assign the RED points which are located within the Red STARS range (assume STARS have range (as circle) is 100m raduis), while the other RED points that are located out of the STAR range let them associated to the 'DOT BLACK' which is located in the center and this black dot has raduis 1000m which is ro as mentioned in the code below'' ?
dipict what we have mentioned in the description
ro=1000; % radius of the layout circle
NumDrones=2; % Number of Drones
NumUEs=20; %Number of users
center=[0 0]; % center of the circle
theta_Drones=2*pi*(rand(NumDrones,1)); % distributed random number of Drones
g = 0.5 * ro + 0.5 * ro * rand(NumDrones,1); % to make them away from the center of circle
PosDrones_x=center(1)+g.*cos(theta_Drones);
PosDrones_y=center(2)+g.*sin(theta_Drones);
PosBSs=[PosDrones_x PosDrones_y];
theta1 = rand(NumUEs, 1) * 2*pi; % distributed random number of Users
r1 = ro * sqrt(rand(NumUEs, 1));
PosUE_x = [r1 .* cos(theta1(:)) + center(:,1)];
PosUE_y = [r1 .* sin(theta1(:)) + center(:,2)];
PosUE = [r1 .* cos(theta1) + center(1),r1 .* sin(theta1(:)) + center(2)];
plot(PosBSs(:,1),PosBSs(:,2),'rp','MarkerSize', 30);
hold on
plot(PosUE(:,1),PosUE(:,2),'r.','MarkerSize', 12);
hold on
PosgNB_x = [0 0, 0 0].';
PosgNB_y = [0 0, 0 0].';
PosgNB = [PosgNB_x,PosgNB_y];
plot(PosgNB_x.',PosgNB_y.','k.','MarkerSize', 40);
hold on
distances = hypot(PosDrones_x-PosUE(:,1).', PosDrones_y-PosUE(:,2).');
distances1 = hypot(PosgNB_x-PosUE(:,1).', PosgNB_y-PosUE(:,2).');
[~, assigned_BS] = min(distances, [],1);
[~, assigned_BS1] = min(distances1, [],1);
plot([PosUE(:,1) PosDrones_x(assigned_BS)].', [PosUE(:,2) PosDrones_y(assigned_BS)].', ...
'color', [0 0 1]);
plot([PosUE(:,1) PosgNB_x(assigned_BS1)].', [PosUE(:,2) PosgNB_y(assigned_BS1)].', ...
'color', [.5 .5 .5])
grid on
hold on
axis equal
t = linspace(0, 2*pi);% Plot the layout of network as circle
plot(ro * cos(t) + center(1),ro * sin(t) + center(2))
matlab
telecommunication
cellular-network
0 Answers
Your Answer