我的fft Python中的错误问题,怎么解决

 我来答
好程序员
2016-09-21 · HTML5前端培训/大数据培训/Java
好程序员
好程序员是IT高端课程培训基地,从平凡到卓越,为梦想而拼搏。
向TA提问
展开全部
Your error might come from the way you define x(t) :
x_t = cos(6.72*(10**7*t) + 3.2*sin(5*(10**5*t))) #Define x(t)
acc = lambda t: (x_t) #Define x[t] in terms of t as a variable in Python's eyes

When Python executes the first line, it assigns to the variable x_t
the value of the formula you're given it using the current value of t ( scipy.linspace(0.01, 32/390625, samples, False) ). It doesn't interpret t as a variable.

To fix this change the second line by this :
acc = lambda t: cos(6.72*(10**7*t) + 3.2*sin(5*(10**5*t)))

EDIT : Just noticed you did the same with signal. Writing : signal = acc(t) (even if you fixed acc) will just assign the result of the function acc(t)
(with the current value of t) to the variable signal. It won't be a
function. (Why don't you just use acc instead of signal as acc is a
function of t anyway ?)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式