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

Revision 1181, 0.8 kB (checked in by zimamiro, 14 years ago)
Line 
1function  [ztrata u y b P]=alstr(system,apriori,seed)
2horizont=system.horizont;
3sigma=system.sigma;
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
15
16    for i=1:horizont   
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        znamenko=sign(y(i)*((-1)^(b(i)<0)));
22        u(i)=-ny*sigma/sqrt(P(i))*znamenko;
23       
24        y(i+1)=y(i)+system.b*u(i)+sigma*seed(i);
25        K=u(i)*P(i)/(P(i)*u(i)^2+sigma^2);
26        b(i+1)=b(i)+K*(y(i+1)-y(i)-b(i)*u(i));
27        P(i+1)=(1-K*u(i))*P(i);   
28       
29        ztrata=ztrata+y(i+1)^2;
30       
31    end
32 end
Note: See TracBrowser for help on using the browser.