analyticsClass.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:pslab-python 作者: fossasia 项目源码 文件源码
def find_frequency(self, v, si):  # voltages, samplimg interval is seconds
        from numpy import fft
        NP = len(v)
        v = v -v.mean()         # remove DC component
        frq = fft.fftfreq(NP, si)[:NP/2]    # take only the +ive half of the frequncy array
        amp = abs(fft.fft(v)[:NP/2])/NP     # and the fft result
        index =  amp.argmax()               # search for the tallest peak, the fundamental
        return frq[index]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号