本文整理汇总了Python中control.statesp.StateSpace.feedback方法的典型用法代码示例。如果您正苦于以下问题:Python StateSpace.feedback方法的具体用法?Python StateSpace.feedback怎么用?Python StateSpace.feedback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类control.statesp.StateSpace
的用法示例。
在下文中一共展示了StateSpace.feedback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMIMOfb2
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import feedback [as 别名]
def testMIMOfb2(self):
sys = StateSpace(np.matrix('-2.0 0 0; 0 -1 1; 0 0 -3'),
np.matrix('1.0 0; 0 0; 0 1'),
np.eye(3), np.zeros((3,2)))
omega = np.logspace(-1, 2, 10)
K = np.matrix('1 0.3 0; 0.1 0 0')
f1 = FRD(sys, omega).feedback(K)
f2 = FRD(sys.feedback(K), omega)
np.testing.assert_array_almost_equal(
f1.freqresp([0.1, 1.0, 10])[0],
f2.freqresp([0.1, 1.0, 10])[0])
np.testing.assert_array_almost_equal(
f1.freqresp([0.1, 1.0, 10])[1],
f2.freqresp([0.1, 1.0, 10])[1])
示例2: testMIMOfb
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import feedback [as 别名]
def testMIMOfb(self):
sys = StateSpace([[-0.5, 0.0], [0.0, -1.0]],
[[1.0, 0.0], [0.0, 1.0]],
[[1.0, 0.0], [0.0, 1.0]],
[[0.0, 0.0], [0.0, 0.0]])
omega = np.logspace(-1, 2, 10)
f1 = FRD(sys, omega).feedback([[0.1, 0.3],[0.0, 1.0]])
f2 = FRD(sys.feedback([[0.1, 0.3],[0.0, 1.0]]), omega)
np.testing.assert_array_almost_equal(
f1.freqresp([0.1, 1.0, 10])[0],
f2.freqresp([0.1, 1.0, 10])[0])
np.testing.assert_array_almost_equal(
f1.freqresp([0.1, 1.0, 10])[1],
f2.freqresp([0.1, 1.0, 10])[1])
示例3: test_scalarStaticGain
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import feedback [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)
示例4: test_matrixStaticGain
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import feedback [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)