% configuracni struktura se bude jmenovat "c"
c.b =1;
c.sigma = 0.1;
c.ndat = 50;
yr = 1;

% nejlepsi mozny regulator - zna b
C1.class='exact_ctrl';
C1.yr   = yr;
C1.b    = c.b;

% CE regulator - b se odhaduje
C2.class='ce_ctrl';
C2.yr   = yr;
C2.b0   = 0;
C2.P0   = 1;

% monte carlo study
n=100;
losses=zeros(10,1);
seeds=32000*rand(1,n);
for i=1:n
    c.b = randn();
    c.seed = seeds(i); 
    c.controller = C1;
    Mmc=iterativemc(c);
    losses(i) = sum((Mmc.y-yr*ones(size(Mmc.y))).^2);
    
    c.controller = C2;
    Mmc=iterativemc(c);
    losses2(i) = sum((Mmc.y-yr*ones(size(Mmc.y))).^2);
end
[min(losses) median(losses) max(losses)]
[min(losses2) median(losses2) max(losses2)]

