开发者

Implementing my own low-pass filter in Java using fft

I'm using: http://introcs.cs.princeton.edu/java/97data/FFT.java.html to implement my own low-pass filter.

How do I rearrange the output from FFT.fft() to zero out the correct values for a correct low-pass filter开发者_运维技巧?


When given a waveform of N samples, this FFT implementation returns an array of size N, that you have to consider as two consecutive array of size N/2:

  • the first goes from index 0 to index N/2-1,
  • the second goes from index N/2 to the end of the array.

Each of them contain the complex energy for each integer frequency between 0 and N/2 (except that one is the opposite of the other).

So if you want to silence all signals equal or above frequency F, you have to zero out:

  • all the values from F to N/2-1 inclusive, and
  • all the values from N/2-1+F to N/2-1 inclusive.

Then you can run the inverse FFT to get your filtered signal.


I imagine that you would zero out all the values in the y array returned from the fft method that have a frequency (determined by the the array index) above your cut-off.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜