root/applications/dual/SIDP/bakalarka/SIDPS/matlab/motor/dualni_rizeni.asv @ 1351

Revision 1351, 0.9 kB (checked in by zimamiro, 13 years ago)
Line 
1function [ztrata omega]=dualni_rizeni(system,apriori)
2horizont=system.horizont_rizeni;
3ztrata=0;
4H=apriori.H;
5x_hat=H(:,1);
6
7system.S=zeros(1,3);
8for i=1:horizont
9    [u system]=simple_control(system,x_hat);
10    u=
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
22figure
23plot(zas(1,:)); hold on
24plot(zas(2,:)); hold off
25figure
26plot(omega(1,:),'-'); hold on
27plot(omega(2,:),'.-.'); hold off
28legend('SKUTECNE','ODHAD');
29figure
30plot(theta(1,:),'-'); hold on
31plot(theta(2,:),'.-.'); hold off
32legend('SKUTECNE','ODHAD');
33figure
34plot(neurcitost)
35ztrata
36
37end
Note: See TracBrowser for help on using the browser.