-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathue_generator.m
53 lines (46 loc) · 1.22 KB
/
ue_generator.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function mobiles=ue_generator(base,pico,V,UE_flag)
%% UE_GENERATOR Summary of this function goes here
% This function generates user equipments with random distributed near
% small cells
param;
rand('state',sum(100*clock));
location = [];
%% UE number initialize
if (UE_flag==1)
N=num_pico*randi(UE_max,1,T);
else
N=[6 6 12 12 6];
end
%% Initialzie
mobiles.location=cell(T,1);
mobiles.direction=cell(T,1);;
mobiles.velocity=V;
mobiles.shadowing = [];
mobiles.distance=[];
mobiles.pathloss=[];
mobiles.angle=[];
mobiles.amount=N;
mobiles.SIR=[];
mobiles.nRx = 2;
mobiles.nfft = 1024;
for t=1:T
location=0;
for c=1:N(t)
b=1;
while(b==1)
x = real(pico.location(ceil(c/(N(t)/num_pico))))+10*(rand(1,1)*2-1);
y = imag(pico.location(ceil(c/(N(t)/num_pico))))+10*(rand(1,1)*2-1); % 25 m
loc = (x) + 1i*(y);
if ((sum(abs(loc-location)<=5)==0)||(c==1))&&abs(loc)<=radius*sqrt(3)/2 %%40m %% 10
location(c) = loc;
b=0;
end
end
end
rand('state',sum(rand*111*clock));
direction=2*pi*rand(1,N(t));
mobiles.location{t}=location;
mobiles.direction{t}=direction;
mobiles.velocity(t)=V;
end
end