-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparameterGeneration.m
executable file
·47 lines (46 loc) · 1.13 KB
/
parameterGeneration.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
%function [sigmas,varphi,noise] = parameterGeneration(A,points,beta,instavel)
function sigmas = parameterGeneration(varargin)
A = varargin{1};
points = varargin{2};
instavel = false;
if nargin == 3
instavel = varargin{3};
elseif nargin > 3
error('Error. Maximum inputs exceeded');
end
j = 1;
N = length(A);
sigmas =[];
while j<(points+1)
% Random Alpha
sigma = rand(1,N);
sigma = sigma/sum(sigma);
Asigma = 0;
for k=1:N
Asigma = Asigma + A{k}*sigma(k);
end
if max(abs(eig(Asigma))) > 1 && instavel == true
if points-j > 8
if j<20
samples = randi([2 4],1,1);
else
samples = randi([2 8],1,1);
end
else
samples = points - j + 1;
end
sigma = sigma.*ones(samples,N);
sigmas = vertcat(sigmas,sigma);
j = j + samples;
elseif instavel == false
if points-j > 8
samples = randi([2 8],1,1);
else
samples = points - j + 1;
end
sigma = sigma.*ones(samples,N);
sigmas = vertcat(sigmas,sigma);
j = j + samples;
end
end
end