root/applications/dual/SIDP/bakalarka/SIDPS/matlab/motor/jednoduche_rizeni.m @ 1351

Revision 1351, 0.9 kB (checked in by zimamiro, 13 years ago)
Line 
1function [ztrata omega]=jednoduche_rizeni(system,apriori)
2kresli=0;
3horizont=system.horizont_rizeni;
4ztrata=0;
5H=apriori.H;
6x_hat=H(:,1);
7
8system.S=zeros(1,3);
9for i=1:horizont
10    [u system]=simple_control(system,x_hat);
11    system.x=get_next(system,system.x,u);
12    H=kalman_filter(H,u,system);
13    x_hat=H(:,1);
14    omega(1,i)=system.x(3);
15    omega(2,i)=x_hat(3);
16    theta(1,i)=system.x(4);
17    theta(2,i)=x_hat(4);
18    ztrata= ztrata+u'*system.gamma*u+(system.x-system.x_opt)'*system.ksi*(system.x-system.x_opt);
19    neurcitost(i)=H(4,5);
20    zas(:,i)=u;
21end
22if(kresli)
23figure
24plot(zas(1,:)); hold on
25plot(zas(2,:)); hold off
26figure
27plot(omega(1,:),'-'); hold on
28plot(omega(2,:),'.-.'); hold off
29legend('SKUTECNE','ODHAD');
30figure
31plot(theta(1,:),'-'); hold on
32plot(theta(2,:),'.-.'); hold off
33legend('SKUTECNE','ODHAD');
34figure
35plot(neurcitost)
36ztrata
37end
38
39end
Note: See TracBrowser for help on using the browser.