思考题:
代码如下:
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
sys = signal.lti([-1, 2], [1, 2, 3])
t = np.arange(0, 5, 0.01)
f = 3 + np.cos(2 * t) + np.cos(5 * t)
# 获取系统的稳态响应
t, y, x = signal.lsim(sys, f, t)
plt.plot(t, y)
plt.grid(True)
plt.title("Steady-State Response")
plt.xlabel("t")
plt.show()
运行结果如下: