function smc_simple(N,n) system.sigma=0.01; system.ny=0.02; system.x=0.5; apriori=[0 1]; x_1=apriori(:,1)*ones(1,N)+apriori(:,2:end)*(0.5-rand(1,N)); vahy=1/N*ones(1,N); N_tresh=N/2; stav=[]; hranice=stav; for i=1:n x_0=my_sample(vahy,x_1); x_1=model_simple(x_0,system); system.x=model_simple(system.x,system); system.pozorovani=system.x+sqrt(system.ny)*randn; reziduum=system.pozorovani*ones(1,N)-x_1; p_v=exp(-(reziduum.^2/system.ny)/2); vahy=p_v/sum(p_v); %porovnani(x_1,vahy,system.x); if (1/(vahy*vahy')