Revision 1113, 0.8 kB
(checked in by zimamiro, 14 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=ps(regulator_parameters,system,apriori,seed)
|
---|
2 |
|
---|
3 | horizont=regulator_parameters.horizont;
|
---|
4 | prvni_faze=1;
|
---|
5 | druha_faze=horizont-prvni_faze;
|
---|
6 |
|
---|
7 | y=zeros(1,horizont);
|
---|
8 | b=zeros(1,prvni_faze+1);
|
---|
9 | P=zeros(1,prvni_faze+1);
|
---|
10 | u=zeros(1,horizont-1);
|
---|
11 | ztrata=0;
|
---|
12 |
|
---|
13 | y(1)=apriori(1);
|
---|
14 | b(1)=apriori(2);
|
---|
15 | P(1)=apriori(3);
|
---|
16 |
|
---|
17 | for 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;
|
---|
22 | end
|
---|
23 | b_1=b(end);
|
---|
24 |
|
---|
25 | for 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;
|
---|
29 | end
|
---|
30 |
|
---|
31 | end
|
---|
32 |
|
---|