当前位置:   article > 正文

python获取信号频率和周期_从FFT中求出信号的周期

python 计算信号频率

我有一个周期信号,我想找出周期。

由于存在边界效应,我首先去掉边界,通过观察第一个和最后一个极小值保持N个周期。在

然后,计算FFT。在

代码:import numpy as np

from matplotlib import pyplot as plt

# The list of a periodic something

L = [2.762, 2.762, 1.508, 2.758, 2.765, 2.765, 2.761, 1.507, 2.757, 2.757, 2.764, 2.764, 1.512, 2.76, 2.766, 2.766, 2.763, 1.51, 2.759, 2.759, 2.765, 2.765, 1.514, 2.761, 2.758, 2.758, 2.764, 1.513, 2.76, 2.76, 2.757, 2.757, 1.508, 2.763, 2.759, 2.759, 2.766, 1.517, 4.012]

# Round because there is a slight variation around actually equals values: 2.762, 2.761 or 1.508, 1.507

L = [round(elt, 1) for elt in L]

minima = min(L)

min_id = L.index(minima)

start = L.index(minima)

stop = L[::-1].index(minima)

L = L[start:len(L)-stop]<

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/106595
推荐阅读
相关标签
  

闽ICP备14008679号