We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 49779aa commit f8ba0d9Copy full SHA for f8ba0d9
control/statefbk.py
@@ -1027,7 +1027,7 @@ def ctrb(A, B, t=None):
1027
ctrb = np.zeros((n, t * m))
1028
ctrb[:, :m] = bmat
1029
for k in range(1, t):
1030
- ctrb[:, k * m:(k + 1) * m] = amat @ ctrb[:, (k - 1) * m:k * m]
+ ctrb[:, k * m:(k + 1) * m] = np.dot(amat, ctrb[:, (k - 1) * m:k * m])
1031
1032
return _ssmatrix(ctrb)
1033
@@ -1070,7 +1070,7 @@ def obsv(A, C, t=None):
1070
obsv[:p, :] = cmat
1071
1072
1073
- obsv[k * p:(k + 1) * p, :] = obsv[(k - 1) * p:k * p, :] @ amat
+ obsv[k * p:(k + 1) * p, :] = np.dot(obsv[(k - 1) * p:k * p, :], amat)
1074
1075
return _ssmatrix(obsv)
1076
control/tests/statefbk_test.py
@@ -49,6 +49,14 @@ def testCtrbMIMO(self):
49
Wc = ctrb(A, B)
50
np.testing.assert_array_almost_equal(Wc, Wctrue)
51
52
+ def testCtrbT(self):
53
+ A = np.array([[1., 2.], [3., 4.]])
54
+ B = np.array([[5., 6.], [7., 8.]])
55
+ t = 1
56
+ Wctrue = np.array([[5., 6.], [7., 8.]])
57
+ Wc = ctrb(A, B, t=t)
58
+ np.testing.assert_array_almost_equal(Wc, Wctrue)
59
+
60
def testObsvSISO(self):
61
A = np.array([[1., 2.], [3., 4.]])
62
C = np.array([[5., 7.]])
@@ -62,6 +70,14 @@ def testObsvMIMO(self):
70
Wotrue = np.array([[5., 6.], [7., 8.], [23., 34.], [31., 46.]])
63
71
Wo = obsv(A, C)
64
72
np.testing.assert_array_almost_equal(Wo, Wotrue)
73
74
+ def testObsvT(self):
75
76
+ C = np.array([[5., 6.], [7., 8.]])
77
78
+ Wotrue = np.array([[5., 6.], [7., 8.]])
79
+ Wo = obsv(A, C, t=t)
80
+ np.testing.assert_array_almost_equal(Wo, Wotrue)
65
81
66
82
def testCtrbObsvDuality(self):
67
83
A = np.array([[1.2, -2.3], [3.4, -4.5]])
0 commit comments