home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 7.ddi / ROBUST.DI$ / LQG.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.5 KB  |  50 lines

  1. function [af,bf,cf,df] = lqg(Z1,Z2,Z3,Z4,Z5,Z6)
  2. % [SS_F] = LQG(SS_,W,V) or
  3. % [AF,BF,CF,DF] = LQG(A,B,C,D,W,V) computes Linear-Quadratic-Gaussian
  4. %    optimal controller via the "seperation principle", such that the 
  5. %    cost function           
  6. %                     T
  7. %    J    = lim E{ int   |x' u'| W |x| dt} , W = |Q  Nc|, is minimized 
  8. %     LQG   T-->inf   0            |u|           |Nc' R| 
  9. %    and subject to the plant  
  10. %                       dx/dt = Ax + Bu + xi
  11. %                           y = Cx + Du + th
  12. %
  13. %    where the white noises {xi} and {th} have the cross-correlation
  14. %    function with intensity V, i.e.
  15. %
  16. %           E{|xi| |xi th|'} = V delta(t-tau), V =  |Xi  Nf|.
  17. %             |th|                                  |Nf' Th|
  18. %
  19. %    The LQG optimal controller F(s) is returned in SS_F or (af,bf,cf,df).
  20. %    The standard state-space can be recovered by "branch".
  21.  
  22. % R. Y. Chiang & M. G. Safonov 8/86
  23. % Copyright (c) 1988 by the MathWorks, Inc.
  24. % All Rights Reserved.
  25. % -------------------------------------------------------------------------
  26.  
  27. inargs = '(A,B,C,D,W,V)';
  28. eval(mkargs(inargs,nargin,'ss'))
  29. %
  30. [ns,ns] = size(A);
  31. [nout,nin]= size(D);
  32. %
  33. % ------- Regular LQG problem:
  34. %
  35. Kf = lqrc(A',C',V); Kf = Kf';
  36. Kc = lqrc(A,B,W);
  37. %
  38. % ------- Final Controller:
  39. %
  40. af = A - B*Kc - Kf*C + Kf*D*Kc;
  41. bf = Kf; 
  42. cf = Kc; 
  43. df = zeros(nin,nout);
  44. %
  45. if xsflag
  46.    af = mksys(af,bf,cf,df);
  47. end
  48. %
  49. % ------- End of LQG.M -- RYC/MGS %
  50.