开发者

Butterworth Filter -- why do I get such weird coefficients?

开发者 https://www.devze.com 2023-01-06 05:59 出处:网络
I\'ve got code to calculate IIR filter coefficients, but they seem to lead to a really strange output.This is what the data looks like:sampled at 1 KHz with a 7 Hz excitation oscillation on top of it.

I've got code to calculate IIR filter coefficients, but they seem to lead to a really strange output. This is what the data looks like: sampled at 1 KHz with a 7 Hz excitation oscillation on top of it. I'd like to make the filter so that it filters with a cutoff frequency of 1 Hz.

Based on what I have read on the web, to calculate the cutoff frequency in fractions of PI, the equation is 2 * fc / fs, leading to a cutoff frequency of 0.002. First off, is that correct? That value gives me coefficients that lead to values that are about three orders of magnitude smaller than I would have expected. Second, when I plot the output of the filter on an array of 250 points, I expect a (mostly) flat line, but I get something that actually looks like an exponential into the negative. 开发者_如何学运维 That can't be right...can it?

I apologize for not knowing that much about filters here. It would be nice if somebody had an answer.

Thanks -- Robert


Firstly, yes, the normalized frequency is 0.002, if fs = 1 kHz and fc = 1 Hz.

You don't say what software you used to calculate the coeffs, what the coeffs actually are, and what IIR form you are using to realise the filter. Note that filters can get tricky when fc << fs though - try a more reasonable fc first, e.g. 100 Hz, to see if that behaves acceptably - that will tell you whether your methods are sound and/or whether things are blowing up when fc gets too small.


Another possible solution is to use a higher order filter and separate it into biquads which requires some analytical work or more googling ;-). My implementation of Butterworth filter coefficient calculation can be found here: http://baumdevblog.blogspot.com/2010/11/butterworth-lowpass-filter-coefficients.html

If your bandwidth is more important than some ripple, I would also look at different filter types (like elliptic)!

0

精彩评论

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