Does there away to make the drones flying toward the exact positions of users by using Matlab?

1 次查看(过去 30 天)
Does there away to make the drones flying toward the exact positions of users (users and drones are randomly distributed ), which means is there away to learn the drones the positions of users ?
ro=1000; % radius of the layout circle
ri=500;
NumDrones=2; % Number of Drones
NumUEs=10; %Number of users
center=[0 0]; % center of the circle
NumgNB=1; % Number of ground Base stations gNB
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', 30);
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
% Plot the layout of network as circle
t = linspace(0, 2*pi);
plot(ro * cos(t) + center(1),ro * sin(t) + center(2))

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Parallel Server 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by