root/applications/dual/SIDP/SIDPS/matlab/cc.m @ 1197

Revision 1181, 0.5 kB (checked in by zimamiro, 14 years ago)
Line 
1function [ztrata u y b P]=cc(system,apriori,seed)
2
3horizont=system.horizont;
4
5y=zeros(1,horizont);
6b=zeros(1,horizont);
7P=zeros(1,horizont);
8u=zeros(1,horizont-1);
9ztrata=0;
10
11y(1)=apriori.y0;
12b(1)=apriori.b0;
13P(1)=apriori.P0;
14
15for 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;
24end
25
26end
27
Note: See TracBrowser for help on using the browser.