i need matlab code for 50 random user locations, 8 Access Points and 1 Base Station on one plane....using m file

2 views (last 30 days)
function project() %x= number of user x=50; %y= access point y=8; %z=base station z=2.5;
t1=randn(1,x) t2=randn(1,y)
figure(1) xlabel('x-candidate') ylabel('y-candidate') t=0:0.1:5;
for i=1:x t2=randn(1,x); plot(t1,t,z) grid on
for i =1:x t1=randn(1,y); plot(t2,t,z) grid on end end

Accepted Answer

sixwwwwww
sixwwwwww on 6 Dec 2013
Edited: sixwwwwww on 6 Dec 2013
you can do it like this:
figure('Color', 'white')
UserLocationX = randi(50, 1, 50);
UserLocationY = randi(50, 1, 50);
plot(UserLocationX, UserLocationY, '^', 'MarkerSize', 5, 'LineWidth', 3), hold on
AccessPointX = randi(50, 1, 8);
AccessPointY = randi(50, 1, 8);
plot(AccessPointX, AccessPointY, 'go', 'MarkerSize', 5, 'LineWidth', 4), hold on
BaseStationX = 25;
BaseStationY = 25;
plot(BaseStationX, BaseStationY, 'rs', 'MarkerSize', 5, 'LineWidth', 4), hold on, grid on, grid minor
hleg = legend('User Location', 'Access Point', 'Base Station')
set(hleg, 'Location', 'NorthEastOutside')
  1 Comment
sara hamdy
sara hamdy on 8 Aug 2017
i need matlab code for 240 random user locations, 7 macro Base Station one base station to each cell and 10 femto base station to each cell ....using m file function []=hex_cell(n, R, x_o, y_o, c)
if ~exist('c','var')
c = 'k';
end
k = 0:(n-1);
x = x_o + R * sin(2*pi*k/n);
y = y_o + R * cos(2*pi*k/n);
xplot = [x, x(1)];
yplot = [y, y(1)];
plot(xplot, yplot, 'color', c)
R = 50 ; n = 6; x_o = 0; y_o = 0;
hex_cell(n, R, x_o, y_o, 'b') axis equal hold on
hex_cell(n, R, x_o - R*sqrt(3), y_o, 'c') hex_cell(n, R, x_o - R*sqrt(3)/2, y_o + 3*R/2, 'g') hex_cell(n, R, x_o - R*sqrt(3)/2, y_o - 3*R/2, 'k')
hex_cell(n, R, x_o + R*sqrt(3), y_o, 'm') hex_cell(n, R, x_o + R*sqrt(3)/2, y_o + 3*R/2, 'r')
hex_cell(n, R, x_o + R*sqrt(3)/2, y_o - 3*R/2, [1 .5 0])
hold off

Sign in to comment.

More Answers (2)

abdulaziz alofui
abdulaziz alofui on 6 Dec 2013
thanks

abdulaziz alofui
abdulaziz alofui on 6 Dec 2013
  4 Comments

Sign in to comment.

Categories

Find more on Tables in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!