Randomly located access points in a given area

3 views (last 30 days)
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 Comment
Image Analyst
Image Analyst on 15 Jan 2015
Edited: Image Analyst on 15 Jan 2015
Read this and fix the formatting. You can also type control-a control-i in MATLAB in the editor to fix up the indenting.

Sign in to comment.

Answers (1)

mohammed
mohammed on 13 Feb 2023
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.

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!