scipy.signal.
normalize#
- scipy.signal.normalize(b, a)[源]#
归一化连续时间传递函数的分子/分母。
如果 b 的值太接近 0,它们将被移除。在这种情况下,会发出 BadCoefficients 警告。
- 参数:
- b: array_like
传递函数的分子。可以是 2-D 数组,用于归一化多个传递函数。
- a: array_like
传递函数的分母。最多 1-D。
- 返回:
- num: array
归一化传递函数的分子。至少为 1-D 数组。如果输入 num 为 2-D 数组,则为 2-D 数组。
- den: 1-D array
归一化传递函数的分母。
备注
分子和分母的系数应按降幂顺序指定(例如,
s^2 + 3s + 5
将表示为[1, 3, 5]
)。示例
>>> from scipy.signal import normalize
归一化传递函数
(3*s^2 - 2*s + 5) / (2*s^2 + 3*s + 1)
的系数>>> b = [3, -2, 5] >>> a = [2, 3, 1] >>> normalize(b, a) (array([ 1.5, -1. , 2.5]), array([1. , 1.5, 0.5]))
如果例如 b 的第一个系数为 0,则会生成警告。在以下示例中,结果符合预期
>>> import warnings >>> with warnings.catch_warnings(record=True) as w: ... num, den = normalize([0, 3, 6], [2, -5, 4])
>>> num array([1.5, 3. ]) >>> den array([ 1. , -2.5, 2. ])
>>> print(w[0].message) Badly conditioned filter coefficients (numerator): the results may be meaningless