Revision 743, 0.6 kB
(checked in by zimamiro, 15 years ago)
|
|
Line | |
---|
1 | function [H,u, loss]=ce(regulator_parameters,system,apriori)
|
---|
2 | eps=1;
|
---|
3 |
|
---|
4 | horizont=regulator_parameters.horizont;
|
---|
5 |
|
---|
6 | H=zeros(horizont+1,system.dim); % stavy na ridicim horizontu - kazdy bod ma souradnice (y, b, P)
|
---|
7 | u=zeros(1,horizont+1); %u(0)nema smysl
|
---|
8 | loss=0;
|
---|
9 |
|
---|
10 | H(1,1)=apriori.y0;
|
---|
11 | H(1,2)=apriori.b0;
|
---|
12 | H(1,3)=apriori.P0;
|
---|
13 |
|
---|
14 | for i=2:horizont
|
---|
15 | if (H(i-1,2)==0)
|
---|
16 | u(i)=(system.yr(i)-H(i-1,1))/eps;
|
---|
17 | else
|
---|
18 | u(i)=(system.yr(i)-H(i-1,1))/H(i-1,2);
|
---|
19 | end
|
---|
20 | H(i,:)=get_next(H(i-1,:),u(i),system);
|
---|
21 | loss=loss+(H(i,1)-system.yr(i))^2;
|
---|
22 | end
|
---|
23 |
|
---|
24 | end
|
---|
25 |
|
---|