Code covered by the BSD License

# Continuous and discrete time optimal reduced order LQG output feedback

### Gerard Van Willigenburg (view profile)

17 Jan 2011 (Updated )

Optimal reduced-oder LQG output feedback controllers

[fo,ko,lo,sigp,sigs,spr,pt,st,sigc]=delfotin(p,g,c,v,w,q,r,delta);
```% DELFOTIN: Deterministic Parameter Continuous Full-Order Time Invariant
%           iNfinite horizon delta LQG compensation.
%           Optimal compensation of (P,G,C,V,W) based on (Q,R) nc=nx.
%           (P,G,C) deterministic.
%
%           [fo,ko,lo,sigp,sigs,spr,pt,st,sigc]=delfotin(p,g,c,v,w,q,r,delta);
% or
%           [fo,ko,lo,sigp,sigs,spr,pt,st,sigc]=delfotin(func);
%
% Input:
%          func  : string containing the function name of the function that
%                  specifies all estimator problem parameters (see e.g. cofu).
% Output:
%          fo, ko, lo : Optimal compensator
%          sigp, sigs,
%                sigc : Minimum costs (if sigs=sigp)
%          spr        : Spectral radius close loop system.
%          pt, st     : Solutions estimator and control Riccati equations.
%
%          L.G. Van Willigenburg, W.L. De Koning, 28-11-95.
%

function [fo,ko,lo,sigp,sigs,spr,pt,st,sigc]=delfotin(p,g,c,v,w,q,r,delta);

%
% Get problem data from func=p if p is a string
%
if isstr(p);
func=p; [p,g,c,v,w,q,r,delta]=feval(func);
end;
%
% Check dimensions
%
[nx,ny,nu,q,mc,v,me]=pgcchk(p,g,c,v,w,q,r);
[nx1,nx2]=size(q);
if nx1~=nx | nx2~=nx; error('q incompatible with p'); end;
[nu1,nu2]=size(r);
if nu1~=nu | nu2~=nu; error('r incompatible with g'); end;
%
% Compute full-order optimal feedback
%
[lo,st] = dellqr(p,g,q,r,delta,mc);
%
% Compute full-order optimal estimator
%
[ko,pt] = dellqr(p',c',v,w,delta,me);
%
% Determine full-order optimal compensator and costs
%
ko=ko'; fo=p-g*lo-ko*c;

sigs=trace(v*st+lo'*(r+delta*g'*st*g)*lo*pt);
sigp=trace(q*pt+ko*(w+delta*c*pt*c')*ko'*st);
if delta~=0; sigp=delta*sigp; sigs=delta*sigs; end

pa=[p -g*lo ; ko*c fo]; spr=maxreig(pa,delta);
if spr>0; sigc=Inf; spr=maxreig(p,delta); fo=[]; ko=[]; lo=[];
elseif nargout==9
qa=[q -mc*lo ; -lo'*mc' lo'*r*lo ];
va=[v  me*ko';  ko *me' ko *w*ko'];
pp=dellyap(pa,va,delta) ; sigc=trace(qa*pp);
%    ss=dellyap(pa',qa,delta); sigc=trace(va*ss);
if delta~=0; sigc=delta*sigc; end;
end
```