Revision 1105, 0.7 kB
(checked in by zimamiro, 15 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=triv(regulator_parameters,system,apriori) |
---|
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 | u(1)=10*system.sigma*randn; |
---|
18 | y(2)=y(1)+u(1)*system.b+system.sigma*randn; |
---|
19 | ztrata=ztrata+(y(i+1)-system.yr(i+1))^2; |
---|
20 | b_1=(y(2)-y(1))/u(1); |
---|
21 | |
---|
22 | for i=1:druha_faze-1 |
---|
23 | u(i+prvni_faze)=(system.yr(i+prvni_faze)-y(i+prvni_faze))/b_1; |
---|
24 | y(i+1+prvni_faze)=y(i+prvni_faze)+system.b*u(i+prvni_faze)+system.sigma*randn; |
---|
25 | ztrata=ztrata+(y(i+1+prvni_faze)-system.yr(i+1+prvni_faze))^2; |
---|
26 | end |
---|
27 | |
---|
28 | end |
---|