本文整理汇总了Python中control.statesp.StateSpace.lft方法的典型用法代码示例。如果您正苦于以下问题:Python StateSpace.lft方法的具体用法?Python StateSpace.lft怎么用?Python StateSpace.lft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类control.statesp.StateSpace
的用法示例。
在下文中一共展示了StateSpace.lft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_lft
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import lft [as 别名]
def test_lft(self):
""" test lft function with result obtained from matlab implementation"""
# test case
A = [[1, 2, 3],
[1, 4, 5],
[2, 3, 4]]
B = [[0, 2],
[5, 6],
[5, 2]]
C = [[1, 4, 5],
[2, 3, 0]]
D = [[0, 0],
[3, 0]]
P = StateSpace(A, B, C, D)
Ak = [[0, 2, 3],
[2, 3, 5],
[2, 1, 9]]
Bk = [[1, 1],
[2, 3],
[9, 4]]
Ck = [[1, 4, 5],
[2, 3, 6]]
Dk = [[0, 2],
[0, 0]]
K = StateSpace(Ak, Bk, Ck, Dk)
# case 1
pk = P.lft(K, 2, 1)
Amatlab = [1, 2, 3, 4, 6, 12, 1, 4, 5, 17, 38, 61, 2, 3, 4, 9, 26, 37, 2, 3, 0, 3, 14, 18, 4, 6, 0, 8, 27, 35, 18, 27, 0, 29, 109, 144]
Bmatlab = [0, 10, 10, 7, 15, 58]
Cmatlab = [1, 4, 5, 0, 0, 0]
Dmatlab = [0]
np.testing.assert_allclose(np.array(pk.A).reshape(-1), Amatlab)
np.testing.assert_allclose(np.array(pk.B).reshape(-1), Bmatlab)
np.testing.assert_allclose(np.array(pk.C).reshape(-1), Cmatlab)
np.testing.assert_allclose(np.array(pk.D).reshape(-1), Dmatlab)
# case 2
pk = P.lft(K)
Amatlab = [1, 2, 3, 4, 6, 12, -3, -2, 5, 11, 14, 31, -2, -3, 4, 3, 2, 7, 0.6, 3.4, 5, -0.6, -0.4, 0, 0.8, 6.2, 10, 0.2, -4.2, -4, 7.4, 33.6, 45, -0.4, -8.6, -3]
Bmatlab = []
Cmatlab = []
Dmatlab = []
np.testing.assert_allclose(np.array(pk.A).reshape(-1), Amatlab)
np.testing.assert_allclose(np.array(pk.B).reshape(-1), Bmatlab)
np.testing.assert_allclose(np.array(pk.C).reshape(-1), Cmatlab)
np.testing.assert_allclose(np.array(pk.D).reshape(-1), Dmatlab)