如何强制signal.sawtooth从0开始?(How to force the signal.sawtooth to start by 0?)
这可能是一个简单的伎俩,但我不会马上得到它。 我希望锯齿信号从(0,0)开始并上升一个周期的1/4,这样就像窦一样,而不是从(0,-1)开始。
from scipy import signal import matplotlib.pyplot as plt t = np.linspace(0, 1, 500) plt.plot(t, signal.sawtooth(2 * np.pi * 5 * t))it might be a simple trick, but I don't get it right away. I would like the sawtooth signal to start by (0,0) and go up for a 1/4th of a period so like a sinus would do instead of starting by (0,-1).
from scipy import signal import matplotlib.pyplot as plt t = np.linspace(0, 1, 500) plt.plot(t, signal.sawtooth(2 * np.pi * 5 * t))最满意答案
通过pi延迟相位
from scipy import signal import matplotlib.pyplot as plt t = np.linspace(0, 1, 500) plt.plot(t, signal.sawtooth(2 * np.pi * 5 * t-np.pi)) plt.show()只需在参数中添加-np.pi term即可
Delay the phase by pi
from scipy import signal import matplotlib.pyplot as plt t = np.linspace(0, 1, 500) plt.plot(t, signal.sawtooth(2 * np.pi * 5 * t-np.pi)) plt.show()Just add -np.pi term in the argument
更多推荐
发布评论