Revision 1249, 0.5 kB
(checked in by zimamiro, 14 years ago)
|
|
Line | |
---|
1 | function [ztrata H]=lqg_control(system, apriori,regulator_parameters) |
---|
2 | horizont=system.horizont_rizeni; |
---|
3 | ztrata=0; |
---|
4 | |
---|
5 | H=zeros(horizont+1,size(apriori.H,1),size(apriori.H,2)); |
---|
6 | u=zeros(2,horizont+1); |
---|
7 | H(1,:,:)=apriori.H; |
---|
8 | |
---|
9 | for i=1:horizont |
---|
10 | H0(:,:)=H(i,:,:); |
---|
11 | u(:,i)=simple_control(system,H0(:,1), regulator_parameters); |
---|
12 | system.x=get_next(system,system.x,u(:,i)); |
---|
13 | H1=kalman_filter(H0,u(:,i),system); |
---|
14 | H(i+1,:,:)=H1; |
---|
15 | ztrata=ztrata+(H1(:,1)-system.x_opt)^2+u(:,i)*system.gamma*u(:,i)'; |
---|
16 | end |
---|
17 | end |
---|