Randomly located access points in a given area

1 次查看(过去 30 天)
Hello, i have a secenario 40x200m and i want to locate 8 access points and calculate the number inside the circles and then measure the traffic generated in each circles. However, i want to locate access points in a logical random way,, splitting x (200m) axis into 8 parts and then for each 25m. locate one access point randomly. Is there anyone can help me to fix my matlab code please? Here is the code..
AccessPointX = randi(200, 1, 8); AccessPointY = randi(40, 1, 8);
for z=1:8;
xCenter = AccessPointX(z); yCenter = AccessPointY(z);
theta = 0 : 0.01 : 2*pi; radius = 20; x = radius * cos(theta) + xCenter; y = radius * sin(theta) + yCenter; plot(x,y,'y.'); hold on axis square; xlim([0 200]); ylim([0 40]); daspect([1 1 1]) grid on; hold on;
xv = radius * cos(theta) + xCenter; yv = radius * sin(theta) + yCenter; rng default xq = machines(:,1); yq = machines(:,2); xq2 = data(idx_data_it,1)+rand(size(data(idx_data_it,1))); yq2 = data(idx_data_it,2)+rand(size(data(idx_data_it,2))); [in,on] = inpolygon(xq,yq,xv,yv); [in3,on3] = inpolygon(xq2,yq2,xv,yv);
plot(AccessPointX, AccessPointY, 'go', 'MarkerSize', 5, 'LineWidth', 4), hold on
disp('Number of devices inside the cell edge');
numel(xq(in))
end
  1 个评论
Image Analyst
Image Analyst 2015-1-15
编辑:Image Analyst 2015-1-15
Read this and fix the formatting. You can also type control-a control-i in MATLAB in the editor to fix up the indenting.

请先登录,再进行评论。

回答(1 个)

mohammed
mohammed 2023-2-13
Hello all , I have small obstracle in a layout where the access points are have to be placed in different loaction so , can anyone suggest me how to add the access points in a layout.

类别

Help CenterFile Exchange 中查找有关 Debugging and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by