实施Hann窗 [英] Implement Hann Window

查看:286
本文介绍了实施Hann窗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我带进来的数据块,并通过他们通过FFTW得到一些光谱信息。一切似乎是工作,但是我觉得我得到了一些混淆的问题。

I take blocks of incoming data and pass them through fftw to get some spectral information. Everything seems to be working, however I think I'm getting some aliasing issues.

我一直在试图找出如何实现我的数据块Hann窗。谷歌已经没有我的例子。任何想法或链接我应该看什么?

I've been trying to work out how to implement a hann window on my blocks of data. Google has failed me for examples. Any ideas or links I should be looking at?

double dataIn[2048] > /* windowing here? */ > FFT > double freqBins[2048]

更新

感谢奥利您指出我其实想解决的问题是频谱泄漏,不走样......

Thanks to Oli for pointing out the issue I'm actually trying to fix is spectral-leakage, NOT aliasing...

推荐答案

http://en.wikipedia.org/wiki/Hann_function 。自定义的实现如下相当直截了当。只需使用 W(N)的功能倍增,遍历所有的样品(改变 N ,当您去)这就是它。

http://en.wikipedia.org/wiki/Hann_function . The implementation follows from the definition quite straightforwardly. Just use the w(n) function as multiplier, loop through all your samples (changing n as you go), and that's it.

for (int i = 0; i < 2048; i++) {
    double multiplier = 0.5 * (1 - cos(2*PI*i/2047));
    dataOut[i] = multiplier * dataIn[i];
}

这篇关于实施Hann窗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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