frequency_estimator.py 文件源码

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

项目:NetPower_TestBed 作者: Vignesh2208 项目源码 文件源码
def freq_from_fft(sig, fs):
    """
    Estimate frequency from peak of FFT
    """
    # Compute Fourier transform of windowed signal
    windowed = sig * blackmanharris(len(sig))
    f = rfft(windowed)

    # Find the peak and interpolate to get a more accurate peak
    i = argmax(abs(f))  # Just use this for less-accurate, naive version
    true_i = parabolic(log(abs(f)), i)[0]

    # Convert to equivalent frequency
    return fs * true_i / len(windowed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号