Revision 1105, 0.8 kB
(checked in by zimamiro, 15 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=alstr(regulator_parameters,system,apriori) |
---|
2 | horizont=regulator_parameters.horizont; |
---|
3 | sigma=system.sigma; |
---|
4 | |
---|
5 | y=zeros(horizont); |
---|
6 | b=zeros(horizont); |
---|
7 | P=zeros(horizont); |
---|
8 | u=zeros(horizont); |
---|
9 | ztrata=0; |
---|
10 | |
---|
11 | y(1)=apriori(1); |
---|
12 | b(1)=apriori(2); |
---|
13 | P(1)=apriori(3); |
---|
14 | |
---|
15 | |
---|
16 | for i=1:size(H,1)-1 |
---|
17 | eta=abs(y(i))/sigma; |
---|
18 | beta=abs(b(i))/sqrt(P(i)); |
---|
19 | ny=(0.56+beta)/(2.2+0.08*beta+beta^2)*eta+1.9/(1.7+beta^4); |
---|
20 | |
---|
21 | u(i)=-ny*sigma/sqrt(P(i))*sign(y(i)*b(i)); |
---|
22 | |
---|
23 | y(i+1)=y(i)+system.b*u(i)+sigma*randn; |
---|
24 | K=u(i)*P(i)/(P(i)*u(i)^2+sigma^2); |
---|
25 | b(i+1)=b(i)+K*(y(i+1)-y(i)-b(i)*u(i)); |
---|
26 | P(i+1)=(1-K*u(i))*P(i); |
---|
27 | |
---|
28 | ztrata=ztrata+(y(i+1)-system.yr(i))^2; |
---|
29 | |
---|
30 | end |
---|
31 | end |
---|