-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_aps.m
More file actions
44 lines (29 loc) · 1.06 KB
/
Copy pathcreate_aps.m
File metadata and controls
44 lines (29 loc) · 1.06 KB
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
function [ ap_grids ] = create_aps( number_of_aps, number_of_states, buffer )
total_random = number_of_states + buffer;
x_ = (total_random-1).*rand(1,1) + 1;
y_ = (total_random-1).*rand(1,1) + 1;
hold_grids = [];
ap_grids(1, 1) = x_;
ap_grids(1, 2) = y_;
x_ = (total_random-1).*rand(1,1) + 1;
y_ = (total_random-1).*rand(1,1) + 1;
safety = 1;
for i = 2:number_of_aps
x_ = (total_random-1).*rand(1,1) + 1;
y_ = (total_random-1).*rand(1,1) + 1;
while ~check_coords(ap_grids, x_, y_)
x_ = (total_random-1).*rand(1,1) + 1;
y_ = (total_random-1).*rand(1,1) + 1;
if safety > 100
selected = round((no_of_members-1).*rand(1,1) + 1);
safety = 1;
else
safety = safety + 1;
end
end
ap_grids(i, 1) = x_;
ap_grids(i, 2) = y_;
x_ = 0;
y_ = 0;
end
end