-
Notifications
You must be signed in to change notification settings - Fork 0
/
funToMinLang.asv
85 lines (73 loc) · 4.51 KB
/
funToMinLang.asv
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
function err = funToMinLang(eVal)
histDataTOTAL = [89 89 301 72 120 171 58 100 42 38 78 530 37 88 29 176 166 40 44 55 28;
91 91 305 73 120 174 58 101 42 39 77 542 40 90 32 179 170 42 46 55 29;
94 94 309 74 120 178 58 101 42 41 75 555 42 93 36 183 174 44 47 55 31;
98 98 314 75 120 181 58 102 42 43 80 567 43 97 41 188 179 45 48 55 32;
102 102 320 77 120 185 59 103 43 45 82 580 43 101 45 194 183 46 49 55 33;
105 105 326 78 120 188 59 104 43 46 84 592 44 105 48 200 187 47 50 55 34;
109 108 333 80 120 192 59 105 43 47 86 605 45 108 50 206 192 48 51 56 34;
109 108 333 80 120 192 59 105 43 47 86 605 45 108 50 206 192 48 51 56 34;
117 116 345 85 120 200 60 108 43 50 90 628 48 116 52 220 202 50 52 56 36;
121 120 352 87 120 205 60 109 44 51 93 639 49 120 53 226 208 52 53 57 36;
125 123 358 90 120 209 60 110 44 52 95 650 51 124 55 233 213 53 53 57 37;
130 127 363 92 120 213 60 112 45 53 98 660 52 129 57 240 219 54 54 58 37;
134 131 369 95 120 218 61 113 45 55 101 670 53 133 58 246 225 55 55 60 38;
138 136 374 98 120 224 61 114 46 56 103 680 53 137 60 253 231 55 55 63 40;
142 140 380 100 120 230 61 115 47 57 106 690 54 141 61 259 238 56 56 65 41;
147 144 386 103 119 237 61 117 47 58 109 701 55 145 63 265 245 57 57 68 42;
151 148 391 105 119 245 61 118 48 59 112 713 56 148 64 270 251 58 59 70 44;
155 151 397 107 119 254 62 119 49 60 115 726 57 151 66 274 258 59 60 72 45;
160 155 403 109 118 264 62 120 49 62 119 740 58 154 67 277 266 59 60 75 47;
166 160 409 110 118 275 62 121 50 63 122 755 59 157 69 280 275 60 60 77 48;
171 166 415 112 118 287 63 121 50 64 125 771 60 161 70 282 285 61 61 80 50;
177 171 420 114 118 300 63 122 51 66 128 788 60 164 72 285 296 61 62 82 51;
182 175 426 115 118 313 63 123 53 67 132 806 61 166 74 287 308 62 64 85 53;
187 178 431 117 118 325 63 124 55 68 135 825 62 169 77 289 320 63 65 88 54;
192 181 437 119 118 338 63 124 57 69 138 844 63 171 81 291 331 64 67 90 55;
197 184 443 121 118 352 63 125 58 71 142 864 64 173 84 293 341 65 68 92 57;
202 187 450 122 118 367 63 126 60 72 145 885 65 175 87 294 352 66 69 94 59;
214 192 463 124 120 400 63 126 63 74 152 930 68 179 92 291 371 68 72 98 63;
219 196 470 124 121 418 63 126 64 75 155 952 70 182 94 288 381 69 73 100 64;
225 200 478 126 123 437 63 126 64 75 159 975 70 184 95 284 392 71 74 102 65;
230 204 487 126 124 457 62 126 64 76 164 999 71 186 95 280 401 73 75 104 67;
235 207 497 127 126 476 62 126 64 77 170 1025 71 187 94 279 409 74 75 104 68;
246 211 508 128 128 487 62 126 64 78 177 1052 71 191 94 277 417 74 75 104 68;
256 215 514 129 128 496 62 126 64 78 176 1075 72 194 96 275 425 75 75 106 69;
422 261 983 229 129 428 66 129 84 77 281 1090 74 229 148 267 527 75 92 116 68 ] ;
histDataNative = [191 207 341 77 100 366 62 125 75 78 21 874 68 176 64.5 167 340 66 69 60 68;
204 171 309 64 95 180 61 122 75 67 20 873 68 177 87 145 322 66 69 60 67;
221 181 328 68 90 182 62 122 85 66 14 845 68 178 78 144 329 66 70 61 69;
223 193 335 69 84 260 61.1 122 84 66 59.4 847.8 72 202 83 162 406 69 74 63 68;
242 189 335 76 78 260 63.8 128 84 77 60 847.8 71.8 203 89 166 339 69 74 64 68;
295 242 372 76 77 260 63 128 84 77 61 898 72 219 119 154 437 68 74 69 68];
init1966 = 1000000*[89;89;301;72;120;171;58;100;42;38;78;530;37;88;29;176;166;40;44;55;28];
%init2017= 1000000*[422 ;261; 983; 229; 129; 428; 66; 129; 84; 77; 281; 1090; 74; 229; 148; 267; 527; 75; 92; 116; 68];
init2001Native= 1000000*[191 207 341 77 100 366 62 125 75 78 21 874 68 176 64.5 167 340 66 69 60 68];
init2017Native = 1000000*[295 242 372 76 77 260 63 128 84 77 61 898 72 219 119 154 437 68 74 69 68];
init = init2001Native;
histData = histDataNative;
setGlobalx(eVal , 1);
[t,y] = ode45(@vdp1,[0:50],init);
%minimize this...
sumOfSquareDiff =ones(21,1)* 0;
for i = 1:1:21
current = y(:,i);
one = (-current(1:1)+ transpose(histData(1)));
oneSum = sum(one);
two = (-current(29:35)+ transpose(histData(2)));
twoSum =sum(two);
three = (current(51)- transpose(histData(3)));
threeSum = sum(three);
four= (current(51)- transpose(histData(35)));
fourSum = sum(four)
sumOfSquareDiff(i) = sumOfSquareDiff(i) + oneSum^2;
sumOfSquareDiff(i) = sumOfSquareDiff(i) + twoSum^2;
sumOfSquareDiff(i) = sumOfSquareDiff(i) + threeSum^2;
sumOfSquareDiff(i) = sumOfSquareDiff(i) + fourSum^2;
% sumOfSquareDiff(i) = sumOfSquareDiff(i) + threeSum^2;
end
errList = sumOfSquareDiff
err = max(sumOfSquareDiff)
% if (imag(err) >0 || imag(err)<0)
% err= 2*10^50;
end