二阶低通滤波器算法
我需要从信号中滤除一些噪声,而简单的 RC 一阶滤波器似乎还不够。我一直在四处寻找,但还没有找到其他滤波器的算法(尽管有很多例子说明如何使用模拟电路来实现)。有人可以指出我在哪里可以找到这样的算法吗?或者至少在这里写一个?
澄清一下:我从示波器获取信号,并且只有一个周期。这个循环看起来有点像:
125 * (x > 3 ? exp(-(x - 3) / 2) : exp(5*(x - 3)))
现在,信号并不总是具有这种形状,我需要计算信号的导数,这很容易,因为当信号放大到足够大时(每个点相距 160 纳秒),你就可以计算出信号的导数。可以看到很多噪音。因此,在计算导数之前,我需要平坦化信号。
I need to filter some noise from a signal and a simple RC first order filter seems not to be enough. I've been looking around but I haven't found algorithms for other filters (although many examples of how to do it with analogue circuits). Can somebody pinpoint where can I find such algorithms? Or at least write one here?
For clarification: I take the signal from an oscilloscope, and I only have one cycle. This cycle looks a little bit like:
125 * (x > 3 ? exp(-(x - 3) / 2) : exp(5*(x - 3)))
Now, the signal not always have that shape and I need to compute the derivate of the signal, which is easy if not because when one zooms the signal enough (each point is 160 nano seconds appart) you can see a lot of noise. So, before computing derivatives I need to flattern the signal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您询问如何设计比简单一阶更高阶的滤波器,请从此处选择滤波器:关于 Filter_(signal_processing) 的 wiki
只是假设您的问题,所以这里有几个设计点。
1)您可能不希望通带中出现纹波(变化的增益),因为这会扭曲您的信号。
2) 您可能不关心阻带中的纹波,因为无论如何信号应该接近 0。
3)滤波器的阶数越高,它看起来越像理想的方形滤波器。
4) 滚降越高越好,您希望尽快减少通带外的噪声。
5) 您可能关心也可能不关心“群延迟”,它是对不同频率通过滤波器所需时间不同而引起的失真的度量。对于音频,您可能需要不太高的群延迟,因为您可以想象不同的频率分量经历不同的时间(因此相位)变化会导致一些失真。
一旦您根据这些(以及可能的其他)考虑因素选择了所需的过滤器,然后只需使用一些拓扑来实现它,就像提到的这里
If you are asking for how to design a higher order filter than a simple first order, how about choosing a filter from here:wiki on Filter_(signal_processing)
Just hypothesizing about your question, so here are a couple of design points.
1) You probably don't want to have ripple (varying gain) in your pass band, as that would distort your signal.
2) You probably don't care about having ripple in your stop band, as the signal should be close to 0 there anyway.
3) The higher the order of the filter, the more it looks like a ideal square shaped filter.
4) The higher the rolloff the better, you want to cut down on the noise outside of your passband as quickly as possible.
5) You may or may not care about "group delay", which is a measure of the distortion caused by different frequencies taking different times to pass through the filter. For audio, you probably want a not too high group delay, as you can imagine having different frequency components undergoing different time (and thus phase) shifts will cause some distortion.
Once you select the filter you want based on these (and possibly other) considerations, then simply implement it using some topology, like those mentioned here
仅对您的要求进行模糊描述,很难给出任何具体建议。
您需要指定滤波器的参数:采样率、截止频率、过渡带宽度、通带纹波、最小阻带抑制、相位和群延迟是否是一个问题等。一旦您至少确定其中一些参数后,您就可以开始选择合适的滤波器设计的过程,即基本滤波器类型、级数等。
了解您想要过滤哪种信号也会很有帮助 - 是音频、或者其他什么?每个样本有多少位?
With only a vague description of your requirements it's hard to give any specific suggestions.
You need to specify the parameters of your filter: sample rate, cut-off frequency, width of transition band, pass-band ripple, minimum stop-band rejection, whether phase and group delay are an issue, etc. Once you have at least some of these parameters pinned down then you can start the process of selecting an appropriate filter design, i.e. basic filter type, number of stages, etc.
It would also be helpful to know what kind of signal you want to filter - is it audio, or something else ? How many bits per sample ?
您需要对信号进行良好的定义,对噪声进行良好的分析,并清楚地了解两者之间的差异,以便确定哪些算法适合删除其中一个信号而不消除另一个中的信息。然后,您需要定义计算环境(整数或浮点 ALU、加法和乘法周期?),并设置计算预算。二阶 IIR 和千兆点 FFT 之间存在很大差异。
RBJ 的双二阶食谱中描述了一些非常常用的二阶数字滤波器。
You need a good definition of your signal, a good analysis of your noise, and a clear understanding of the difference between the two, in order to determine what algorithms might be appropriate for removing one and not eliminating information in the other. Then you need to define the computational environment (integer or float ALU, add and multiply cycles?), and set a computational budget. There's a big difference between a second-order IIR and a giga-point FFT.
Some very commonly used 2nd-order digital filters are described in RBJ's biquad cookbook.