Revision 723, 0.7 kB
(checked in by smidl, 15 years ago)
|
Big commit of LQG stuff
|
-
Property svn:eol-style set to
native
|
Line | |
---|
1 | % configuracni struktura se bude jmenovat "c" |
---|
2 | c.b =1; |
---|
3 | c.sigma = 0.1; |
---|
4 | c.ndat = 50; |
---|
5 | yr = 1; |
---|
6 | |
---|
7 | % nejlepsi mozny regulator - zna b |
---|
8 | C1.class='exact_ctrl'; |
---|
9 | C1.yr = yr; |
---|
10 | C1.b = c.b; |
---|
11 | |
---|
12 | % CE regulator - b se odhaduje |
---|
13 | C2.class='ce_ctrl'; |
---|
14 | C2.yr = yr; |
---|
15 | C2.b0 = 0; |
---|
16 | C2.P0 = 1; |
---|
17 | |
---|
18 | % monte carlo study |
---|
19 | n=100; |
---|
20 | losses=zeros(10,1); |
---|
21 | seeds=32000*rand(1,n); |
---|
22 | for i=1:n |
---|
23 | c.b = randn(); |
---|
24 | c.seed = seeds(i); |
---|
25 | c.controller = C1; |
---|
26 | Mmc=iterativemc(c); |
---|
27 | losses(i) = sum((Mmc.S_y-yr*ones(size(Mmc.S_y))).^2); |
---|
28 | |
---|
29 | c.controller = C2; |
---|
30 | Mmc=iterativemc(c); |
---|
31 | looo= sum((Mmc.S_y-yr*ones(size(Mmc.S_y))).^2) |
---|
32 | % keyboard |
---|
33 | losses2(i) = looo; |
---|
34 | end |
---|
35 | [min(losses) median(losses) max(losses)] |
---|
36 | [min(losses2) median(losses2) max(losses2)] |
---|
37 | |
---|