Revision 862, 1.0 kB
(checked in by zimamiro, 15 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=rizeni(H,mi,system,apriori)
|
---|
2 |
|
---|
3 | sigma=system.sigma;
|
---|
4 | %%chce to mzslet na PYB
|
---|
5 |
|
---|
6 | y=zeros(size(H,1));
|
---|
7 | b=zeros(size(H,1));
|
---|
8 | P=zeros(size(H,1));
|
---|
9 | u=zeros(size(H,1));
|
---|
10 | ztrata=0;
|
---|
11 |
|
---|
12 | y(1)=apriori(1);
|
---|
13 | b(1)=apriori(2);
|
---|
14 | P(1)=apriori(3);
|
---|
15 |
|
---|
16 |
|
---|
17 | for i=1:size(H,1)-1
|
---|
18 | eta_0=abs(y(i))/sigma;
|
---|
19 | beta_0=abs(b(i))/sqrt(P(i));
|
---|
20 |
|
---|
21 | state(1)=eta_0/(1+eta_0);
|
---|
22 | state(2)=beta_0^2/(1+beta_0^2);
|
---|
23 |
|
---|
24 | index=find_in_hyperstate5(state, H(i,:,:));
|
---|
25 |
|
---|
26 | %plot(H(i,:,1),H(i,:,2),'g.'); hold on
|
---|
27 | %plot(H(i,index,1), H(i,index,2),'r+'); plot(state(1), state(2),'b.'); hold off
|
---|
28 |
|
---|
29 | u(i)=-mi(i,index)*eta_0/beta_0*sigma/sqrt(P(i))*sign(y(i)*b(i));
|
---|
30 |
|
---|
31 | y(i+1)=y(i)+system.b*u(i)+sigma*randn;
|
---|
32 | K=u(i)*P(i)/(P(i)*u(i)^2+sigma^2);
|
---|
33 | b(i+1)=b(i)+K*(y(i+1)-y(i)-b(i)*u(i));
|
---|
34 | P(i+1)=(1-K*u(i))*P(i);
|
---|
35 |
|
---|
36 | ztrata=ztrata+(y(i+1)-system.yr(i))^2;
|
---|
37 |
|
---|
38 | end
|
---|
39 | end
|
---|