How to randomly generate 10 user locations from a two base stations
1 次查看(过去 30 天)
显示 更早的评论
Let's say we have two base stations, the distance between them is 1200 meters, the users are located around them in a distance ranging from 300-600 meters. I need to locate 10 users among those two base stations in a 300-600 distance and I wrote the code below for that purpose. However, this code randomly-allocates the users but doesn't consider that the distance (Euclidian distance if I am right) should be between 600-1800 meters from BS1, nor it gives its exact distance from BS1 (located on the left)
NOBS=2; % Number of Base stations
for ZZ=1:NOBS
NOU=10; % number of users
d=randi([300 600],NOU,1); % generating 10 BS- UE distances ranging from 300 to 600 meters
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196699/image.jpeg)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!