Revision 1181, 0.9 kB
(checked in by zimamiro, 14 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=rizeni(H,C,system,apriori,seed)
|
---|
2 | %RAND
|
---|
3 | sigma=system.sigma;
|
---|
4 | horizont=system.horizont;
|
---|
5 |
|
---|
6 | y=zeros(1,horizont);
|
---|
7 | b=zeros(1,horizont);
|
---|
8 | P=zeros(1,horizont);
|
---|
9 | u=zeros(1,horizont-1);
|
---|
10 | ztrata=0;
|
---|
11 |
|
---|
12 | y(1)=apriori.y0;
|
---|
13 | b(1)=apriori.b0;
|
---|
14 | P(1)=apriori.P0;
|
---|
15 |
|
---|
16 | for i=1:horizont
|
---|
17 | eta=abs(y(i))/sigma;
|
---|
18 | beta=abs(b(i))/sqrt(P(i));
|
---|
19 |
|
---|
20 | %plot(H,'b.'); hold on; plot(index, beta,'r.'); hold off
|
---|
21 |
|
---|
22 | ny=eta*beta/(1+beta^2)+interpol(beta,H,C);
|
---|
23 | %ny=(eta*beta/(1+beta^2)+C(index)*abs(rand));
|
---|
24 | znamenko=sign(y(i)*((-1)^(b(i)<0)));
|
---|
25 | u(i)=-ny*sigma/sqrt(P(i))*znamenko;
|
---|
26 |
|
---|
27 | y(i+1)=y(i)+system.b*u(i)+sigma*seed(i);
|
---|
28 | K=u(i)*P(i)/(P(i)*u(i)^2+sigma^2);
|
---|
29 | b(i+1)=b(i)+K*(y(i+1)-y(i)-b(i)*u(i));
|
---|
30 | P(i+1)=(1-K*u(i))*P(i);
|
---|
31 |
|
---|
32 | ztrata=ztrata+y(i+1)^2;
|
---|
33 | end
|
---|
34 |
|
---|
35 | end
|
---|