本文整理汇总了Python中control.statesp.StateSpace.dcgain方法的典型用法代码示例。如果您正苦于以下问题:Python StateSpace.dcgain方法的具体用法?Python StateSpace.dcgain怎么用?Python StateSpace.dcgain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类control.statesp.StateSpace
的用法示例。
在下文中一共展示了StateSpace.dcgain方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dcgain
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import dcgain [as 别名]
def test_dcgain(self):
sys = StateSpace(-2.,6.,5.,0)
np.testing.assert_equal(sys.dcgain(), 15.)
sys2 = StateSpace(-2, [6., 4.], [[5.],[7.],[11]], np.zeros((3,2)))
expected = np.array([[15., 10.], [21., 14.], [33., 22.]])
np.testing.assert_array_equal(sys2.dcgain(), expected)
sys3 = StateSpace(0., 1., 1., 0.)
np.testing.assert_equal(sys3.dcgain(), np.nan)
示例2: test_dcgain_cont
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import dcgain [as 别名]
def test_dcgain_cont(self):
"""Test DC gain for continuous-time state-space systems"""
sys = StateSpace(-2.,6.,5.,0)
np.testing.assert_equal(sys.dcgain(), 15.)
sys2 = StateSpace(-2, [6., 4.], [[5.],[7.],[11]], np.zeros((3,2)))
expected = np.array([[15., 10.], [21., 14.], [33., 22.]])
np.testing.assert_array_equal(sys2.dcgain(), expected)
sys3 = StateSpace(0., 1., 1., 0.)
np.testing.assert_equal(sys3.dcgain(), np.nan)
示例3: test_dcgain_discr
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import dcgain [as 别名]
def test_dcgain_discr(self):
"""Test DC gain for discrete-time state-space systems"""
# static gain
sys = StateSpace([], [], [], 2, True)
np.testing.assert_equal(sys.dcgain(), 2)
# averaging filter
sys = StateSpace(0.5, 0.5, 1, 0, True)
np.testing.assert_almost_equal(sys.dcgain(), 1)
# differencer
sys = StateSpace(0, 1, -1, 1, True)
np.testing.assert_equal(sys.dcgain(), 0)
# summer
sys = StateSpace(1, 1, 1, 0, True)
np.testing.assert_equal(sys.dcgain(), np.nan)
示例4: test_dcgain_integrator
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import dcgain [as 别名]
def test_dcgain_integrator(self):
"""DC gain when eigenvalue at DC returns appropriately sized array of nan"""
# the SISO case is also tested in test_dc_gain_{cont,discr}
import itertools
# iterate over input and output sizes, and continuous (dt=None) and discrete (dt=True) time
for inputs,outputs,dt in itertools.product(range(1,6),range(1,6),[None,True]):
states = max(inputs,outputs)
# a matrix that is singular at DC, and has no "useless" states as in _remove_useless_states
a = np.triu(np.tile(2,(states,states)))
# eigenvalues all +2, except for ...
a[0,0] = 0 if dt is None else 1
b = np.eye(max(inputs,states))[:states,:inputs]
c = np.eye(max(outputs,states))[:outputs,:states]
d = np.zeros((outputs,inputs))
sys = StateSpace(a,b,c,d,dt)
dc = np.squeeze(np.tile(np.nan,(outputs,inputs)))
np.testing.assert_array_equal(dc, sys.dcgain())