简体   繁体   English

如何创建具有变化幅度和相位的合成余弦波?

[英]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) = tb(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.

相关问题 在numpy中-如何通过将正弦曲线与正弦和余弦相关联来计算正弦曲线的相位和幅度? - In numpy - how do I compute phase and amplitude of a sinusoid by correlating it with a sine and cosine? 如何在Python中得到正弦波的相位直流偏移和幅度 - How to get phase DC offset and amplitude of sine wave in Python 如何创建一个元素为正弦,另一个为余弦波的二维张量? - How can I create a 2D tensor with one element a sine and the other a cosine wave? 为什么在对余弦 function 进行 FFT 时会出现相位? - Why do I get a phase when taking the FFT of a cosine function? 如何在 python 中编辑/创建摩尔斯电码的波形文件? - How do i edit/create a wave file for morse code in python? 我怎样才能很好地预测一个看起来像正弦波的图案幅度的增加趋势,上面有一些噪音 - How can I predict in a good way an increasing trend of the amplitude of a pattern looking like sinus wave with some noise on it 如何在python龟中制作余弦波图? - How to make a cosine wave graph in python turtle? 如何在 Python 中的 plot 正弦波具有突然的幅度变化? - How to plot sine wave in Python with sudden amplitude change? 如何从 python 中的波形文件中获取振幅值列表 - How to get list of amplitude values from a wave file in python 如何在 python 中的指定范围内生成合成数据? - How do I produce synthetic data over a specified range in python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM