Revision 862, 445 bytes
(checked in by zimamiro, 15 years ago)
|
|
Line | |
---|
1 | function [ztrata u y b P]=ce(regulator_parameters,system,apriori)
|
---|
2 |
|
---|
3 | horizont=regulator_parameters.horizont;
|
---|
4 |
|
---|
5 | y=zeros(horizont);
|
---|
6 | b=zeros(horizont);
|
---|
7 | P=zeros(horizont);
|
---|
8 | u=zeros(horizont);
|
---|
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 | u(i)=(system.yr(i)-y(i))/b(i);
|
---|
17 | [y(i+1) b(i+1) P(i+1)]=get_next([y(i) b(i) P(i)],u(i),system);
|
---|
18 | ztrata=ztrata+(y(i+1)-system.yr(i+1))^2;
|
---|
19 | end
|
---|
20 |
|
---|
21 | end
|
---|
22 |
|
---|