root/applications/dual/SIDP/Kopie (2) - finalni implementace/ps.m @ 1166

Revision 1113, 0.8 kB (checked in by zimamiro, 14 years ago)
Line 
1function [ztrata u y b P]=ps(regulator_parameters,system,apriori,seed)
2
3horizont=regulator_parameters.horizont;
4prvni_faze=1;
5druha_faze=horizont-prvni_faze;
6
7y=zeros(1,horizont);
8b=zeros(1,prvni_faze+1);
9P=zeros(1,prvni_faze+1);
10u=zeros(1,horizont-1);
11ztrata=0;
12
13y(1)=apriori(1);
14b(1)=apriori(2);
15P(1)=apriori(3);
16
17for i=1:prvni_faze
18 %   u(i)=10*system.sigma/sqrt(P(i));
19     u(i)=sqrt(abs(100-1/P(i)))*system.sigma;
20    [y(i+1) b(i+1) P(i+1)]=get_next([y(i) b(i) P(i)],u(i),system,seed(i));
21    ztrata=ztrata+(y(i+1)-system.yr(i+1))^2;
22end
23b_1=b(end);
24
25for i=1:druha_faze-1
26    u(i+prvni_faze)=(system.yr(i+prvni_faze)-y(i+prvni_faze))/b_1;
27    y(i+1+prvni_faze)=y(i+prvni_faze)+system.b*u(i+prvni_faze)+system.sigma*seed(i+prvni_faze);
28    ztrata=ztrata+(y(i+1+prvni_faze)-system.yr(i+1+prvni_faze))^2;
29end
30
31end
32
Note: See TracBrowser for help on using the browser.