-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomParameter.m
67 lines (62 loc) · 1.19 KB
/
randomParameter.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% Random Test
lambda = 0.9902;
beta = 0.4;
[A,B,x0,sigmas] = selectExample(3,0.52);
points = size(sigmas,1);
select = 1;
out = LMIChoice(A,B,beta,select,lambda);
clear sigmas
N = 1000;
disp('Setup - Ok')
%%
aux = 0;
pos = 0;
for i=1:N
sigmas{i} = parameterGeneration(A,points);
varphi{i} = varphiGeneration(sigmas{i},beta);
[output,signal,K, P{i}]=justSimulation(out,A,B,sigmas{i},varphi{i},x0);
xk{i} = output;
timeResponse{i} = output(1,:);
signalControl{i} = signal;
kTime{i} = K(:,1);
amplitude = max(kTime{i}) - min(kTime{i});
if(amplitude > aux)
aux = amplitude;
pos = i;
end
end
disp('Data - Ok')
%%
figure
hold on
% N = 100;
start= 1;
for i=start:N
stairs(0:1:points-1,timeResponse{i})
end
figure
hold on
for i=start:N
stairs(0:1:points-1,signalControl{i})
end
figure
hold on
for i=start:N
stairs(0:1:points-1,kTime{i})
end
for i=start:N
for j=1:length(xk{1}(1,:))
aux(j) = xk{i}(:,j)'*P{i}{j}*xk{i}(:,j);
end
aux = aux/max(aux);
V{i} = aux;
end
clear aux
figure
hold on
for i=start:N
stairs(0:1:points-1,V{i},'LineWidth',1.5)
end
grid on
figure
stairs(1:1:points,kTime{pos}/max(kTime{pos})*100,'LineWidth',1.5)