Butterworth filter: Number of coefficients?

6 次查看(过去 30 天)
Hello
I am trying to create a low pass filter. My device has a sample rate of 100 and the cutoff value should be 10 Hz.
But according to the manual the filter should also have a setting "number of coefficients". And this should be 40 in my case...
How can I implement the number of coefficients into the filter?
Thanks.
My Code:
Fs = 100;
Fco = 10;
Fn = Fs/2;
Wn = Fco/Fn;
[b,a]=butter(1,Wn,'low')
m_filtered=filter(b,a,m)

采纳的回答

Star Strider
Star Strider 2020-5-19
The first argument to butter is the filter order, and the number of coefficients in the transfer function vectors will be 1 less than that, so:
Fs = 100;
Fco = 10;
Fn = Fs/2;
Wn = Fco/Fn;
n = 40;
[b,a]=butter(n-1,Wn,'low');
figure
freqz(b,a,2^14,Fs)
should do what you want.
Note that this creates an unstable filter.
Are you absolutely certain that you want to use a IIR filter here? A filter order of 40 is more typical of a FIR filter, especially for a lowpass application such as this. (If you want a FIR filter instead, use the kaiserord and fir1 functions to create it.)
  8 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Filter Analysis 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by