comparison scripts/control/base/dlqr.m @ 7126:4a375de63f66

[project @ 2007-11-08 03:44:14 by jwe]
author jwe
date Thu, 08 Nov 2007 03:44:15 +0000
parents a1dbe9d80eee
children aeeb646f6538
comparison
equal deleted inserted replaced
7125:f084ba47812b 7126:4a375de63f66
126 s = zeros (n, m); 126 s = zeros (n, m);
127 ao = a; 127 ao = a;
128 qo = q; 128 qo = q;
129 endif 129 endif
130 130
131 ## Checking stabilizability and detectability (dimensions are checked inside these calls) 131 ## Checking stabilizability and detectability (dimensions are checked
132 ## inside these calls).
132 tol = 200*eps; 133 tol = 200*eps;
133 if (is_stabilizable (ao, b,tol,1) == 0) 134 if (is_stabilizable (ao, b, tol, 1) == 0)
134 error ("dlqr: (a,b) not stabilizable"); 135 error ("dlqr: (a,b) not stabilizable");
135 endif 136 endif
136 dflag = is_detectable (ao, qo, tol,1); 137 dflag = is_detectable (ao, qo, tol, 1);
137 if ( dflag == 0) 138 if (dflag == 0)
138 warning ("dlqr: (a,q) not detectable"); 139 warning ("dlqr: (a,q) not detectable");
139 elseif ( dflag == -1) 140 elseif (dflag == -1)
140 error("dlqr: (a,q) has non minimal modes near unit circle"); 141 error ("dlqr: (a,q) has non minimal modes near unit circle");
141 end 142 end
142 143
143 ## Compute the Riccati solution 144 ## Compute the Riccati solution
144 p = dare (ao, b, qo, r); 145 p = dare (ao, b, qo, r);
145 k = (r+b'*p*b)\(b'*p*a + s'); 146 k = (r+b'*p*b)\(b'*p*a + s');
146 e = eig (a - b*k); 147 e = eig (a - b*k);
147 148
148
149 endfunction 149 endfunction
150