Given number of base stations and users , how can I accociate each user to the nearest base station?

조회 수: 6 (최근 30일)
I deployed the BSs and Users randomly according to Binomial Point Process, and I assumed to connect each user to nearest BS. So, how can I accociate these users in matlab.
thanks in advance
ro=500; % radius of the layout circle
NumBSs=10; % Number of Base stations
NumUEs=50; %Number of users
center=[0 0]; % center of the circle
theta_BSs=2*pi*(rand(NumPoints,1)); % distributed random number of Base stations
g = 0.5 * ro + 0.5 * ro * rand(NumBSs,1);
PosBSs_x=center(1)+g.*cos(theta_BSs);
PosBSs_y=center(2)+g.*sin(theta_BSs);
theta1 = rand(NumUEs, 1) * 2*pi; % distributed random number of Users
r1 = ro * sqrt(rand(NumUEs, 1));
PosUE = [r1 .* cos(theta1(:)) + center(1),r1 .* sin(theta1(:)) + center(2)];
% Initial plot objects
hfig = figure('Color', 'w');
hax=axes('parent',hfig);
% Plot of deploying points
hdots=plot(PosBSs_x(:,1),PosBSs_y(:,1),'bp',PosUE(:,1),PosUE(:,2),'r.','MarkerSize', 12);
grid on
hold(hax, 'on')
axis(hax, 'equal')
% Plot the layout as circles
t = linspace(0, 2*pi);
plot(ro * cos(t) + center(1),ro * sin(t) + center(2))

채택된 답변

Walter Roberson
Walter Roberson 2021년 12월 14일
pdist2() the coordinates of the stations against the coordinates of the base stations to find the distance from each station to each base station. Then min() along the appropriate axes to determine the index to use.
  댓글 수: 5
omar th
omar th 2021년 12월 18일
But I deployed the drone Base stations (Nodes) and ground base station (gNB=Node) seperately, so when I tried to gether them, I got an error " Dimensions of arrays being concatenated are not consistent"
How could you help me with this issue ?
Thanks for your response
Walter Roberson
Walter Roberson 2021년 12월 19일
For the purposes of pdist2(), you should be using rows in which each row represents one point. If some of your coefficients are represented by columns instead of rows, transpose them.
If you base stations and ground base station are represented by different spatial dimensions (for example, 2D for base stations but 3d for ground base stations), then you need to convert the coordinates to all be the longer length, perhaps by padding with zero.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by