-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_config.m
30 lines (24 loc) · 1.06 KB
/
create_config.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
function config = create_config(num_anchs, num_osf_increments, varargin)
% Creates a random generated num_anchs x num_osf_increments binary
% configuration of strengthened anchors.
config = zeros(num_anchs, num_osf_increments);
% Select which anchors are strengthened
num_strengthened_anchs = ceil(num_anchs * rand);
strengthened_anchs = randperm(num_anchs, num_strengthened_anchs);
% All strengthened anchors use the same OSF index
if ~isempty(varargin)
if strcmpi(varargin{1}, 'uniform')
config(strengthened_anchs, varargin{2}) = 1;
else
error('Variable argument not recognized.')
end
% Strengthened anchors use variable OSFs
else
% Select which overstrength factor is used for each strengthened anchor
osf_selections = randi(num_osf_increments, num_strengthened_anchs, 1);
% Make sure only 1 OSF selection is made per strengthened anchor
for k = 1:length(osf_selections)
config(strengthened_anchs(k), osf_selections(k)) = 1;
end
end
end