Scipy:一些选定频率的傅立叶变换 [英] Scipy : fourier transform of a few selected frequencies

查看:133
本文介绍了Scipy:一些选定频率的傅立叶变换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在信号上使用scipy.fft,并带有移动窗口以绘制随时间变化的频率幅度(此处为

I am using scipy.fft on a signal, with a moving window to plot the amplitudes of frequencies changing with time (here is an example, time is on X, frequency on Y, and amplitude is the color).

但是,只有少数几个频率使我感兴趣(〜3,仅4个频率).使用FFT似乎无法仅选择所需的频率(显然,频率范围是由算法确定的),所以我计算出很多无用的东西,如果信号太长.

However, only a few frequencies interest me (~3, 4 frequencies only). With FFTs it seems like I can't select only the frequencies I want (cause apparently the range of frequencies is determined by the algorithm), so I calculate a lot of useless stuff, and my program even crashes with a MemoryError if the signal is too long.

我该怎么办?我是否必须使用自定义傅里叶变换-在这种情况下,欢迎使用良好实现的链接-还是有scipy的方法?

What should I do ? Do I have to use a custom Fourier transform - in which case, links of good implementations are welcome - , or is there a scipy way ?

编辑

在@jfaller回答之后,我决定(尝试)实现Goertzel算法.我想出了这样的方法: https://gist.github.com/4128537 但它不起作用(频率440不会出现,请不要注意峰值,我也不必费心使用适当的窗口).任何帮助!?我对DSP不好.

After @jfaller answer, I decided to (try to) implement the Goertzel algorithm. I came up with this : https://gist.github.com/4128537 but it doesn't work (frequency 440 doesn't appear, nevermind the peaks, I didn't bother to apply a proper window). Any help !? I am bad with DSP.

推荐答案

您真正要使用Goertzel算法:

You're really looking to use the Goertzel Algorithm: http://en.wikipedia.org/wiki/Goertzel_algorithm. Basically, it's an FFT at a single point, and efficient if you only need a limited number of frequencies in a signal. If you have trouble pulling apart the algorithm from Wikipedia, ping back, and I'll help you. Also if you google a few resources, there exist DTMF decoders (touch tone phone decoders) written in python. You could check out how they do it.

这篇关于Scipy:一些选定频率的傅立叶变换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆