comparison scripts/control/base/dlqr.m @ 3696:5a7174ebc684

[project @ 2000-07-17 19:38:53 by jwe]
author jwe
date Mon, 17 Jul 2000 19:39:47 +0000
parents 99ab64f4a09d
children 22bd65326ec1
comparison
equal deleted inserted replaced
3695:64ca92e02a7e 3696:5a7174ebc684
1 ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. 1 ## Copyright (C) 1993, 1994, 1995 Auburn University
2 ## 2 ##
3 ## This file is part of Octave. 3 ## This file is part of Octave.
4 ## 4 ##
5 ## Octave is free software; you can redistribute it and/or modify it 5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by the 6 ## under the terms of the GNU General Public License as published by the
93 ## @end iftex 93 ## @end iftex
94 ## @ifinfo 94 ## @ifinfo
95 ## (@var{a} - @var{b}@var{k}). 95 ## (@var{a} - @var{b}@var{k}).
96 ## @end ifinfo 96 ## @end ifinfo
97 ## @end table 97 ## @end table
98 ## @strong{References}
99 ## @enumerate
100 ## @item Anderson and Moore, Optimal Control: Linear Quadratic Methods,
101 ## Prentice-Hall, 1990, pp. 56-58
102 ## @item Kuo, Digital Control Systems, Harcourt Brace Jovanovich, 1992,
103 ## section 11-5-2.
104 ## @end enumerate
105 ## @end deftypefn 98 ## @end deftypefn
106 99
107 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> 100 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
108 ## Created: August 1993 101 ## Created: August 1993
109 ## Converted to discrete time by R. B. Tenison 102 ## Converted to discrete time by R. B. Tenison
110 ## (btenison@eng.auburn.edu) October 1993 103 ## (btenison@eng.auburn.edu) October 1993
104 ## Modified by Gabriele Pannocchia <pannocchia@ing.unipi.it>
105 ## July 2000
111 106
112 function [k, p, e] = dlqr (a, b, q, r, s) 107 function [k, p, e] = dlqr (a, b, q, r, s)
113 108
114 if (nargin != 4 && nargin != 5) 109 if (nargin != 4 && nargin != 5)
115 error ("dlqr: invalid number of arguments"); 110 error ("dlqr: invalid number of arguments");
152 ao = a; 147 ao = a;
153 qo = q; 148 qo = q;
154 endif 149 endif
155 150
156 ## Check that q, (r) are symmetric, positive (semi)definite 151 ## Check that q, (r) are symmetric, positive (semi)definite
157 if (is_symmetric (q) && is_symmetric (r) ... 152 if (is_symmetric (q) && is_symmetric (r)
158 && all (eig (q) >= 0) && all (eig (r) > 0)) 153 && all (eig (q) >= 0) && all (eig (r) > 0))
159 p = dare (ao, b, qo, r); 154 p = dare (ao, b, qo, r);
160 k = (r+b'*p*b)\b'*p*a + r\s'; 155 k = (r+b'*p*b)\(b'*p*a + s');
161 e = eig (a - b*k); 156 e = eig (a - b*k);
162 else 157 else
163 error ("dlqr: q (r) must be symmetric positive (semi) definite"); 158 error ("dlqr: q (r) must be symmetric positive (semi) definite");
164 endif 159 endif
165 160
166 endfunction 161 endfunction
162