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

3 次查看(过去 30 天)
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

采纳的回答

sixwwwwww
sixwwwwww 2013-12-6
编辑:sixwwwwww 2013-12-6
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 个评论
sara hamdy
sara hamdy 2017-8-8
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

请先登录,再进行评论。

更多回答(2 个)

abdulaziz alofui
abdulaziz alofui 2013-12-6
thanks

abdulaziz alofui
abdulaziz alofui 2013-12-6
  4 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Just for fun 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by