home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 10.ddi / CONTROL.DI$ / DLQRY.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  870 b   |  32 lines

  1. function [k,s,e] = dlqry(a,b,c,d,q,r)
  2. %DLQRY    Linear quadratic regulator design with output weighting for 
  3. %    discrete-time systems.
  4. %
  5. %    [K,S,E] = DLQRY(A,B,C,D,Q,R)  calculates the optimal feedback gain
  6. %    matrix K such that the feedback law  u[n] = -Kx[n]  minimizes the
  7. %    cost function
  8. %
  9. %        J = Sum {y'Qy + u'Ru}
  10. %
  11. %    subject to the constraint equation:   
  12. %
  13. %        x[n+1] = Ax[n] + Bu[n] 
  14. %          y[n] = Cx[n] + Du[n]
  15. %                
  16. %    Also returned is S, the steady-state solution to the associated 
  17. %    discrete matrix Riccati equation and the closed loop eigenvalues
  18. %    E = EIG(A-B*K).
  19. %
  20. %    The controller can be formed with DREG.
  21. %
  22. %    See also: DLQR, LQRD, and DREG.
  23.  
  24. %    Clay M. Thompson  7-23-90
  25. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  26.  
  27. error(nargchk(6,6,nargin));
  28. qq = c'*q*c;
  29. rr = r + d'*q*d;
  30. nn = c'*q*d;
  31. [k,s,e] = dlqr(a,b,qq,rr,nn);
  32.