本文整理汇总了Python中control.statesp.StateSpace.freqresp方法的典型用法代码示例。如果您正苦于以下问题:Python StateSpace.freqresp方法的具体用法?Python StateSpace.freqresp怎么用?Python StateSpace.freqresp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类control.statesp.StateSpace
的用法示例。
在下文中一共展示了StateSpace.freqresp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testMIMO
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import freqresp [as 别名]
def testMIMO(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)
np.testing.assert_array_almost_equal(
sys.freqresp([0.1, 1.0, 10])[0],
f1.freqresp([0.1, 1.0, 10])[0])
np.testing.assert_array_almost_equal(
sys.freqresp([0.1, 1.0, 10])[1],
f1.freqresp([0.1, 1.0, 10])[1])
示例2: test_siso
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import freqresp [as 别名]
def test_siso(self):
B = np.matrix('0;1')
D = 0
sys = StateSpace(self.A,B,self.C,D)
# test frequency response
frq=sys.freqresp(self.omega)
# test bode plot
bode(sys)
# Convert to transfer function and test bode
systf = tf(sys)
bode(systf)
示例3: testFreqResp
# 需要导入模块: from control.statesp import StateSpace [as 别名]
# 或者: from control.statesp.StateSpace import freqresp [as 别名]
def testFreqResp(self):
"""Evaluate the frequency response at multiple frequencies."""
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)
truemag = [[[0.0852992637230322, 0.00103596611395218],
[0.935374692849736, 0.799380720864549]],
[[0.55656854563842, 0.301542699860857],
[0.609178071542849, 0.0382108097985257]]]
truephase = [[[-0.566195599644593, -1.68063565332582],
[3.0465958317514, 3.14141384339534]],
[[2.90457947657161, 3.10601268291914],
[-0.438157380501337, -1.40720969147217]]]
trueomega = [0.1, 10.]
mag, phase, omega = sys.freqresp(trueomega)
np.testing.assert_almost_equal(mag, truemag)
np.testing.assert_almost_equal(phase, truephase)
np.testing.assert_equal(omega, trueomega)