在Matlab中设计一个简单的带通/带阻滤波器 [英] Designing a simple bandpass/bandstop filter in Matlab

查看:2210
本文介绍了在Matlab中设计一个简单的带通/带阻滤波器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一项家庭作业,我必须在Matlab中设计一个简单的带通滤波器,该滤波器可以滤除250Hz至1000 Hz之间的所有信号.到目前为止,我所做的是: -使用"enframe"功能创建半重叠的窗口,每个窗口有512个样本.在窗户上,我应用了hann窗户功能. -在每个窗口上应用fft.之后,我使用ifft函数重建了原始信号,一切正常.

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.

但是问题是我必须如何解释fft函数的结果以及如何过滤出频带.

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.

如果您的任务是通过操纵信号FFT来特定地来操作信号,请忽略我.否则,请继续阅读.

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

FFT通常用于分析频域中的信号.如果您开始摆弄FFT返回的复数系数,那么您将陷入一个复杂的数学情况.由于您的截止频率不会很好地位于FFT频段频率上,因此尤其如此.另外,请记住,FFT并不是您正在分析的信号的完美转换.由于扇贝错误,并与您的Hann窗口卷积.

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.

所以..让我们离开FFT进行分析,然后建立一个滤波器.

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

如果您在课堂上进行带通设计,我将假设您了解他们的工作. Matlab中有许多函数可以为不同类型的滤波器生成系数,即butterkaiser cheby1.在Matlab中查找其帮助页面以获取更多信息.您插入这些功能的值将取决于您的滤波器规格,即您希望"X" dB衰减和"Y" dB通带纹波.您需要对这些过滤器的工作原理有所了解,并需要了解它们的传递函数,以了解它们的过滤器顺序与您的规格之间的关系.

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.

一旦有了系数,就只是通过filter函数运行它们的一种情况(同样,如果不确定如何工作,请查看帮助页面).

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).

强大的JOS在此处上具有出色的演练.

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

另一个小问题..在您的问题中,您提到要让滤波器滤除" 250Hz至1000Hz之间的所有信号.这有点模棱两可.如果要设计带通滤波器,则需要通过" 250Hz至1000Hz之间的所有信号.如果您这样做实际上是要滤除"该范围内的所有内容,则需要带阻滤波器.

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.

这篇关于在Matlab中设计一个简单的带通/带阻滤波器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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