python计算频率_如何计算给定波的频率和时间

据我所见,你的代码基本上是好的,但是缺少一些细节。我认为你的问题主要是解释。因此,模拟数据现在是最好看的,下面是一个示例,其中包含我在注释中建议的模拟数据(我添加了关于重要行的注释,以及##用于更改):import numpy as npimport scipy as syimport scipy.fftpack as syfpimport pylab as pyldt = 0.02071t = ...
摘要由CSDN通过智能技术生成

据我所见,你的代码基本上是好的,但是缺少一些细节。我认为你的问题主要是解释。因此,模拟数据现在是最好看的,下面是一个示例,其中包含我在注释中建议的模拟数据(我添加了关于重要行的注释,以及##用于更改):import numpy as np

import scipy as sy

import scipy.fftpack as syfp

import pylab as pyl

dt = 0.02071

t = dt*np.arange(100000) ## time at the same spacing of your data

u = np.sin(2*np.pi*t*.01) ## Note freq=0.01 Hz

# Do FFT analysis of array

FFT = sy.fft(u)

# Getting the related frequencies

freqs = syfp.fftfreq(len(u), dt) ## added dt, so x-axis is in meaningful units

# Create subplot windows and show plot

pyl.subplot(211)

pyl.plot(t, u)

pyl.xlabel('Time')

pyl.ylabel('Amplitude')

pyl.subplot(212)

pyl.plot(freqs, sy.log10(abs(FFT)), '.') ## it's important to have the abs here

pyl.xlim(-.05, .05) #

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值