function realization=generate_realization(apriori,H0,H_tilde,C,regulator_parameters,system)

H=add_Hc_tilde0(H0,apriori,regulator_parameters); % nehlidam pozitivni definitnost !
realization=0;
system.S=zeros(1,3);
for o=1:regulator_parameters.horizont_simulace
    [best_control system]=simple_control(system,H(:,1));
    best_control=best_control+interpol(H,H_tilde,C);
    x=H(:,1)+sqrt(diag(H(:,2:5))).*randn(4,1);
    x=get_next(system,x,best_control);
    H=kalman(H,best_control);
    realization=realization+(system.x_opt(3)-)^2;
end
end