Revision 1113, 0.5 kB
(checked in by zimamiro, 15 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=ce(regulator_parameters,system,apriori,seed)
|
---|
2 | eps=0.01;
|
---|
3 | horizont=regulator_parameters.horizont;
|
---|
4 |
|
---|
5 | y=zeros(1,horizont);
|
---|
6 | b=zeros(1,horizont-1);
|
---|
7 | P=zeros(1,horizont-1);
|
---|
8 | u=zeros(1,horizont-1);
|
---|
9 | ztrata=0;
|
---|
10 |
|
---|
11 | y(1)=apriori(1);
|
---|
12 | b(1)=apriori(2);
|
---|
13 | P(1)=apriori(3);
|
---|
14 |
|
---|
15 | for i=1:horizont-1
|
---|
16 | if abs(b(i))<eps
|
---|
17 | u(i)=randn;
|
---|
18 | else
|
---|
19 | u(i)=-y(i)/b(i);
|
---|
20 | end
|
---|
21 | [y(i+1) b(i+1) P(i+1)]=get_next([y(i) b(i) P(i)],u(i),system,seed(i));
|
---|
22 | ztrata=ztrata+y(i+1)^2;
|
---|
23 | end
|
---|
24 |
|
---|
25 | end
|
---|
26 |
|
---|