root/applications/dual/experiment/lq_P.m @ 1263

Revision 754, 1.0 kB (checked in by smidl, 15 years ago)

fixes + LQ for dual control

Line 
1function [ulq]  = c2008lqcM(A, B, C, Xt, yp, N, P)
2% function computes LQ controller for unit Qy and zero Qu with given
3% uncertainty matrix P, which is a N-dimensional cell of P matrices on the considered
4% horizon.
5
6% vector of the quadratic form z is [u,y_{t-1},1]
7
8
9dx=size(A,1); du=size(B,2); dy=size(C,1);
10
11Qy = eye(dy);
12qx=C'*Qy*C;
13
14qux=zeros(du,dx+du+dy);
15if ~iscell(P)
16    qux(:,1:du)=P;
17end
18qyx=[C,-eye(dy)];
19
20
21s=1e-5*eye(dx+dy); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22
23pr=[B,A, zeros(dx, dy);
24    zeros(dy,dx+du), eye(dy)];
25
26hqy=Qy*qyx*pr
27hqy(:,du+dx+1:du+dx+dy)=-Qy*diag(yp)
28 
29nstep=N;
30for i=1:nstep,
31    if iscell(P)
32        qux(:,1:du)=P{nstep-i+1};
33    end
34       
35    h= s*pr;
36    pomqr=[h;hqy;qux];
37    hn=triu(qr(pomqr));   
38    s=hn(du+1:end,du+1:end);
39
40    ws=hn(1:du,du+1:end);
41    wsd=hn(1:du,1:du);
42 
43    Bellman_core=s'*s
44    L=-inv(wsd)*ws
45    sprintf('u_t = %f y_{t-1} + %f ',L(1), L(2))
46
47end
48 
49ulq=L*[Xt;ones(dy,1)];                % ��zen� u na z�lad� LQ synt�zy
50keyboard
51
Note: See TracBrowser for help on using the browser.