本文整理汇总了Python中control.statesp.StateSpace.evalfr方法的典型用法代码示例。如果您正苦于以下问题:Python StateSpace.evalfr方法的具体用法?Python StateSpace.evalfr怎么用?Python StateSpace.evalfr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类control.statesp.StateSpace
的用法示例。
在下文中一共展示了StateSpace.evalfr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_evalfr
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import evalfr [as 别名]
def test_evalfr(self):
"""Evaluate the frequency response at one frequency."""
A = [[-2, 0.5], [0.5, -0.3]]
B = [[0.3, -1.3], [0.1, 0.]]
C = [[0., 0.1], [-0.3, -0.2]]
D = [[0., -0.8], [-0.3, 0.]]
sys = StateSpace(A, B, C, D)
resp = [[4.37636761487965e-05 - 0.0152297592997812j,
-0.792603938730853 + 0.0261706783369803j],
[-0.331544857768052 + 0.0576105032822757j,
0.128919037199125 - 0.143824945295405j]]
# Correct versions of the call
np.testing.assert_almost_equal(evalfr(sys, 1j), resp)
np.testing.assert_almost_equal(sys._evalfr(1.), resp)
# Deprecated version of the call (should generate warning)
import warnings
with warnings.catch_warnings(record=True) as w:
# Set up warnings filter to only show warnings in control module
warnings.filterwarnings("ignore")
warnings.filterwarnings("always", module="control")
# Make sure that we get a pending deprecation warning
sys.evalfr(1.)
assert len(w) == 1
assert issubclass(w[-1].category, PendingDeprecationWarning)
示例2: testEvalFr
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import evalfr [as 别名]
def testEvalFr(self):
"""Evaluate the frequency response at one frequency."""
A = [[-2, 0.5], [0.5, -0.3]]
B = [[0.3, -1.3], [0.1, 0.]]
C = [[0., 0.1], [-0.3, -0.2]]
D = [[0., -0.8], [-0.3, 0.]]
sys = StateSpace(A, B, C, D)
resp = [[4.37636761487965e-05 - 0.0152297592997812j,
-0.792603938730853 + 0.0261706783369803j],
[-0.331544857768052 + 0.0576105032822757j,
0.128919037199125 - 0.143824945295405j]]
np.testing.assert_almost_equal(sys.evalfr(1.), resp)