Revision 1249, 489 bytes
(checked in by zimamiro, 14 years ago)
|
|
Line | |
---|
1 | function [ztrata omega]=jednoduche_rizeni(system,apriori) |
---|
2 | horizont=system.horizont_rizeni; |
---|
3 | x_hat=zeros(1,4); |
---|
4 | omega=zeros(2,horizont); |
---|
5 | ztrata=0; |
---|
6 | H=apriori.H; |
---|
7 | |
---|
8 | for i=1:horizont |
---|
9 | u=-simple_control(system,x_hat); |
---|
10 | system.x=get_next(system,system.x,u); |
---|
11 | H=kalman_filter(H,u,system); |
---|
12 | x_hat=H(:,1); |
---|
13 | omega(1,i)=system.x(3); |
---|
14 | omega(2,i)=x_hat(3); |
---|
15 | ztrata= ztrata+u'*system.gamma*u+(system.x-system.x_opt)'*system.ksi*(system.x-system.x_opt); |
---|
16 | end |
---|
17 | plot() |
---|
18 | |
---|
19 | end |
---|