本文整理汇总了Python中control.statesp.StateSpace.append方法的典型用法代码示例。如果您正苦于以下问题:Python StateSpace.append方法的具体用法?Python StateSpace.append怎么用?Python StateSpace.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类control.statesp.StateSpace
的用法示例。
在下文中一共展示了StateSpace.append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scalarStaticGain
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import append [as 别名]
def test_scalarStaticGain(self):
"""Regression: can we create a scalar static gain?"""
g1=StateSpace([],[],[],[2])
g2=StateSpace([],[],[],[3])
# make sure StateSpace internals, specifically ABC matrix
# sizes, are OK for LTI operations
g3 = g1*g2
self.assertEqual(6, g3.D[0,0])
g4 = g1+g2
self.assertEqual(5, g4.D[0,0])
g5 = g1.feedback(g2)
self.assertAlmostEqual(2./7, g5.D[0,0])
g6 = g1.append(g2)
np.testing.assert_array_equal(np.diag([2,3]),g6.D)
示例2: test_matrixStaticGain
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import append [as 别名]
def test_matrixStaticGain(self):
"""Regression: can we create matrix static gains?"""
d1 = np.matrix([[1,2,3],[4,5,6]])
d2 = np.matrix([[7,8],[9,10],[11,12]])
g1=StateSpace([],[],[],d1)
# _remove_useless_states was making A = [[0]]
self.assertEqual((0,0), g1.A.shape)
g2=StateSpace([],[],[],d2)
g3=StateSpace([],[],[],d2.T)
h1 = g1*g2
np.testing.assert_array_equal(d1*d2, h1.D)
h2 = g1+g3
np.testing.assert_array_equal(d1+d2.T, h2.D)
h3 = g1.feedback(g2)
np.testing.assert_array_almost_equal(solve(np.eye(2)+d1*d2,d1), h3.D)
h4 = g1.append(g2)
np.testing.assert_array_equal(block_diag(d1,d2),h4.D)
示例3: testAppendTF
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import append [as 别名]
def testAppendTF(self):
"""Test appending a state-space system with a tf"""
A1 = [[-2, 0.5, 0], [0.5, -0.3, 0], [0, 0, -0.1]]
B1 = [[0.3, -1.3], [0.1, 0.], [1.0, 0.0]]
C1 = [[0., 0.1, 0.0], [-0.3, -0.2, 0.0]]
D1 = [[0., -0.8], [-0.3, 0.]]
s = TransferFunction([1, 0], [1])
h = 1/(s+1)/(s+2)
sys1 = StateSpace(A1, B1, C1, D1)
sys2 = _convertToStateSpace(h)
sys3c = sys1.append(sys2)
np.testing.assert_array_almost_equal(sys1.A, sys3c.A[:3,:3])
np.testing.assert_array_almost_equal(sys1.B, sys3c.B[:3,:2])
np.testing.assert_array_almost_equal(sys1.C, sys3c.C[:2,:3])
np.testing.assert_array_almost_equal(sys1.D, sys3c.D[:2,:2])
np.testing.assert_array_almost_equal(sys2.A, sys3c.A[3:,3:])
np.testing.assert_array_almost_equal(sys2.B, sys3c.B[3:,2:])
np.testing.assert_array_almost_equal(sys2.C, sys3c.C[2:,3:])
np.testing.assert_array_almost_equal(sys2.D, sys3c.D[2:,2:])
np.testing.assert_array_almost_equal(sys3c.A[:3,3:], np.zeros( (3, 2)) )
np.testing.assert_array_almost_equal(sys3c.A[3:,:3], np.zeros( (2, 3)) )
示例4: testAppendSS
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import append [as 别名]
def testAppendSS(self):
"""Test appending two state-space systems"""
A1 = [[-2, 0.5, 0], [0.5, -0.3, 0], [0, 0, -0.1]]
B1 = [[0.3, -1.3], [0.1, 0.], [1.0, 0.0]]
C1 = [[0., 0.1, 0.0], [-0.3, -0.2, 0.0]]
D1 = [[0., -0.8], [-0.3, 0.]]
A2 = [[-1.]]
B2 = [[1.2]]
C2 = [[0.5]]
D2 = [[0.4]]
A3 = [[-2, 0.5, 0, 0], [0.5, -0.3, 0, 0], [0, 0, -0.1, 0],
[0, 0, 0., -1.]]
B3 = [[0.3, -1.3, 0], [0.1, 0., 0], [1.0, 0.0, 0], [0., 0, 1.2]]
C3 = [[0., 0.1, 0.0, 0.0], [-0.3, -0.2, 0.0, 0.0], [0., 0., 0., 0.5]]
D3 = [[0., -0.8, 0.], [-0.3, 0., 0.], [0., 0., 0.4]]
sys1 = StateSpace(A1, B1, C1, D1)
sys2 = StateSpace(A2, B2, C2, D2)
sys3 = StateSpace(A3, B3, C3, D3)
sys3c = sys1.append(sys2)
np.testing.assert_array_almost_equal(sys3.A, sys3c.A)
np.testing.assert_array_almost_equal(sys3.B, sys3c.B)
np.testing.assert_array_almost_equal(sys3.C, sys3c.C)
np.testing.assert_array_almost_equal(sys3.D, sys3c.D)