MATLAB Answers

Butterworth filter: Number of coefficients?

조회 수: 7(최근 30일)
Max Behr
Max Behr 19 May 2020
댓글: Star Strider 19 May 2020
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)

  댓글 수: 0

Sign in to comment.

채택된 답변

Star Strider
Star Strider 19 May 2020
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

표시 이전 댓글 수: 5
Star Strider
Star Strider 19 May 2020
My pleasure!
The filter order can be anything you want that meets your minimum requirements. My observation was simply a suggestion. (My background is also in biomedical signal processing, among other related topics.)
If my Answer helped you solve your problem, please Accept it!
.
Max Behr
Max Behr 19 May 2020
Thanks again :)
I did it!
Star Strider
Star Strider 19 May 2020
As always, my pleasure!
Thank you!

Sign in to comment.

추가 답변(0개)


Translated by