[英]How do I create a synthetic cosine wave with changing amplitude and phase?
I am trying to make a cosine wave on numpy that changes with amplitude and phase over time?我试图在 numpy 上制作一个随时间变化的幅度和相位的余弦波? How might I do that?
我该怎么做?
I have this so far, but the amplitude nor phase is changing over time:到目前为止我有这个,但幅度和相位随着时间的推移而变化:
east_sine = np.zeros((50,50))
sine = np.zeros((50))
for t in range(50):
for x in range(50):
sine[x] = np.sin(20*x*np.pi/100 - .1*t)
east_sine[t,:] = sine
Please be more specific with your questions.请更具体地提出您的问题。
If you want to have time-dependent amplitude and phase, you need define the sine in the form:如果您想要具有时间相关的幅度和相位,您需要以如下形式定义正弦:
sine = A(t) * sin(a*x - b(t)*t)
For example, where A(t) = t
and b(t) = 0.1 t**2
:例如,其中
A(t) = t
和b(t) = 0.1 t**2
:
x = np.linspace(0,50,1000)
t = np.linspace(0,10,1000)
sine = t * np.sin(x - 0.1*np.square(t)*t)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.