Revision 1181, 0.5 kB
(checked in by zimamiro, 14 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=cc(system,apriori,seed)
|
---|
2 |
|
---|
3 | horizont=system.horizont;
|
---|
4 |
|
---|
5 | y=zeros(1,horizont);
|
---|
6 | b=zeros(1,horizont);
|
---|
7 | P=zeros(1,horizont);
|
---|
8 | u=zeros(1,horizont-1);
|
---|
9 | ztrata=0;
|
---|
10 |
|
---|
11 | y(1)=apriori.y0;
|
---|
12 | b(1)=apriori.b0;
|
---|
13 | P(1)=apriori.P0;
|
---|
14 |
|
---|
15 | for i=1:horizont
|
---|
16 | u(i)=-y(i)*b(i)/(b(i)^2+P(i));
|
---|
17 |
|
---|
18 | y(i+1)=y(i)+system.b*u(i)+system.sigma*seed(i);
|
---|
19 | K=u(i)*P(i)/(P(i)*u(i)^2+system.sigma^2);
|
---|
20 | b(i+1)=b(i)+K*(y(i+1)-y(i)-b(i)*u(i));
|
---|
21 | P(i+1)=(1-K*u(i))*P(i);
|
---|
22 |
|
---|
23 | ztrata=ztrata+y(i+1)^2;
|
---|
24 | end
|
---|
25 |
|
---|
26 | end
|
---|
27 |
|
---|