-
Notifications
You must be signed in to change notification settings - Fork 2
/
plotCalpha.m
105 lines (98 loc) · 2.43 KB
/
plotCalpha.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
% general settings
N = 500; % number of samples
numSteps = N*1000; % steps of the function
vecAlpha = linspace(0,1,100);
% cases to be tested
w = 5;
q = 1;
init2D;
allT = linspace(0,t_f,numSteps+1);
% costCont = x_0'*Kinf*x_0;
% uDot = diff(uOpt(allT))./diff(allT); % needed in optDensM
% for iter=1:length(vecAlpha)
% mA = vecAlpha(iter);
% optDensM;
% cMa = N*N*(minCost-costCont)/(costCont*t_f*t_f);
% vec1(iter) = cMa;
% end
figure(1);
plot(allT,uOpt(allT),'r');
hold on
figure(2);
semilogy(vecAlpha,vec1,'r');
hold on
q = 10;
init2D;
% costCont = x_0'*Kinf*x_0;
% uDot = diff(uOpt(allT))./diff(allT); % needed in optDensM
% for iter=1:length(vecAlpha)
% mA = vecAlpha(iter);
% optDensM;
% cMa = N*N*(minCost-costCont)/(costCont*t_f*t_f);
% vec2(iter) = cMa;
% end
figure(1);
plot(allT,uOpt(allT),'k');
figure(2);
semilogy(vecAlpha,vec2,'k');
q = 100;
init2D;
% costCont = x_0'*Kinf*x_0;
% uDot = diff(uOpt(allT))./diff(allT); % needed in optDensM
% for iter=1:length(vecAlpha)
% mA = vecAlpha(iter);
% optDensM;
% cMa = N*N*(minCost-costCont)/(costCont*t_f*t_f);
% vec3(iter) = cMa;
% end
figure(1);
plot(allT,uOpt(allT),'b');
figure(2);
semilogy(vecAlpha,vec3,'b');
w = 25;
q = 1;
init2D;
% costCont = x_0'*Kinf*x_0;
% uDot = diff(uOpt(allT))./diff(allT); % needed in optDensM
% for iter=1:length(vecAlpha)
% mA = vecAlpha(iter);
% optDensM;
% cMa = N*N*(minCost-costCont)/(costCont*t_f*t_f);
% vec4(iter) = cMa;
% end
figure(1);
plot(allT,uOpt(allT),'r--');
hold on
figure(2);
semilogy(vecAlpha,vec4,'r--');
hold on
q = 10;
init2D;
% costCont = x_0'*Kinf*x_0;
% uDot = diff(uOpt(allT))./diff(allT); % needed in optDensM
% for iter=1:length(vecAlpha)
% mA = vecAlpha(iter);
% optDensM;
% cMa = N*N*(minCost-costCont)/(costCont*t_f*t_f);
% vec5(iter) = cMa;
% end
figure(1);
plot(allT,uOpt(allT),'k--');
figure(2);
semilogy(vecAlpha,vec5,'k--');
q = 100;
init2D;
% costCont = x_0'*Kinf*x_0;
% uDot = diff(uOpt(allT))./diff(allT); % needed in optDensM
% for iter=1:length(vecAlpha)
% mA = vecAlpha(iter);
% optDensM;
% cMa = N*N*(minCost-costCont)/(costCont*t_f*t_f);
% vec6(iter) = cMa;
% end
figure(1);
plot(allT,uOpt(allT),'b--');
figure(2);
semilogy(vecAlpha,vec6,'b--');
clear AD Avec BD Bvec Cvec K0 KD Kvec PD PDvec QD QDvec RD RDvec Uvec Xvec cMa costCont curH curK densToSamp i ind intDens iter k mA minCost lll tk tauK uDot uDotM uOpt
save('CvsAlphaN500.mat');