|
6 | 6 | from __future__ import print_function |
7 | 7 | import unittest |
8 | 8 | import numpy as np |
9 | | -from control.statefbk import ctrb, obsv, place, place_varga, lqr, gram, acker |
| 9 | +from control.statefbk import ctrb, obsv, place, place_varga, lqr, lqe, gram, acker |
10 | 10 | from control.matlab import * |
11 | 11 | from control.exception import slycot_check, ControlDimension |
12 | 12 | from control.mateqn import care, dare |
@@ -299,6 +299,20 @@ def test_LQR_3args(self): |
299 | 299 | K, S, poles = lqr(sys, Q, R) |
300 | 300 | self.check_LQR(K, S, poles, Q, R) |
301 | 301 |
|
| 302 | + def check_LQE(self, L, P, poles, G, QN, RN): |
| 303 | + P_expected = np.array(np.sqrt(G*QN*G * RN)) |
| 304 | + L_expected = P_expected / RN |
| 305 | + poles_expected = np.array([-L_expected], ndmin=2) |
| 306 | + np.testing.assert_array_almost_equal(P, P_expected) |
| 307 | + np.testing.assert_array_almost_equal(L, L_expected) |
| 308 | + np.testing.assert_array_almost_equal(poles, poles_expected) |
| 309 | + |
| 310 | + @unittest.skipIf(not slycot_check(), "slycot not installed") |
| 311 | + def test_LQE(self): |
| 312 | + A, G, C, QN, RN = 0., .1, 1., 10., 2. |
| 313 | + L, P, poles = lqe(A, G, C, QN, RN) |
| 314 | + self.check_LQE(L, P, poles, G, QN, RN) |
| 315 | + |
302 | 316 | @unittest.skipIf(not slycot_check(), "slycot not installed") |
303 | 317 | def test_care(self): |
304 | 318 | #unit test for stabilizing and anti-stabilizing feedbacks |
|
0 commit comments