Revision 1105, 0.7 kB
(checked in by zimamiro, 15 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=ps(regulator_parameters,system,apriori) |
---|
2 | |
---|
3 | horizont=regulator_parameters.horizont; |
---|
4 | prvni_faze=2; |
---|
5 | druha_faze=horizont-prvni_faze; |
---|
6 | |
---|
7 | y=zeros(horizont); |
---|
8 | b=zeros(horizont); |
---|
9 | P=zeros(horizont); |
---|
10 | u=zeros(horizont); |
---|
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)=(system.yr(i)-y(i))/b(i); |
---|
19 | [y(i+1) b(i+1) P(i+1)]=get_next([y(i) b(i) P(i)],u(i),system); |
---|
20 | ztrata=ztrata+(y(i+1)-system.yr(i+1))^2; |
---|
21 | end |
---|
22 | |
---|
23 | for i=1:druha_faze |
---|
24 | u(i)=(system.yr(i)-y(i))/b(i); |
---|
25 | [y(i+1) b(i+1) P(i+1)]=get_next([y(i) b(i) P(i)],u(i),system); |
---|
26 | ztrata=ztrata+(y(i+1)-system.yr(i+1))^2; |
---|
27 | end |
---|
28 | |
---|
29 | end |
---|