基于java的带通滤波器设计,在Matlab中设计一个简单的带通/带阻滤波器

For a homework assignment I have to design a simple bandpass filter in Matlab that filters out everything between 250Hz and 1000 Hz. What I did so far:

- using the 'enframe' function to create half overlapping windows with 512 samples each. On the windows I apply the hann window function.

- On each window I apply an fft. After this I reconstruct the original signal with the function ifft, that all goes well.

But the problem is how I have to interpret the result of the fft function and how to filter out a frequency band.

解决方案

Unless I'm mistaken, it sounds like you're taking the wrong approach to this.

If your assignment is to manipulate a signal specifically by manipulating its FFT then ignore me. Otherwise.. read on.

The FFT is normally used to analyse a signal in the frequency domain. If you start fiddling with the complex coefficients that an FFT returns then you're getting into a complicated mathematical situation. This is particularly the case since your cut-off frequencies aren't going to lie nicely on FFT bin frequencies. Also, remember that the FFT is not a perfect transform of the signal you're analysing. It will always introduce artefacts of its own due to scalloping error, and convolution with your hann window.

So.. let's leave the FFT for analysis, and build a filter.

If you're doing band-pass design in your class I'm going to assume you understand what they do. There's a number of functions in Matlab to generate the coefficients for different types of filter i.e. butter, kaiser cheby1. Look up their help pages in Matlab for loads more info. The values you plug in to these functions will be dependent on your filter specification, i.e. you want "X"dB rolloff and "Y"dB passband ripple. You'll need some idea of the how these filters work, and knowledge of their transfer functions to understand how their filter order relates to your specification.

Once you have your coefficients, it's just a case of running them through the filter function (again.. check the help page if you're not sure how this works).

The mighty JOS has a great walkthrough of bandpass filter design here.

One other little niggle.. in your question you mentioned that you want your filter to "filter out" everything between 250Hz and 1000Hz. This is a bit ambiguous. If you're designing a bandpass filter you would want to "pass" everything between 250Hz and 1000Hz. If you do in fact want to "filter out" everything in this range you want a band-stop filter instead.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值