Butterworth filtering with bandpass and 3. order

20 visualizzazioni (ultimi 30 giorni)
GerRu
GerRu il 16 Mar 2016
Commentato: Ced il 16 Mar 2016
Hi everybody, I've got a Problem with the butter function. I wanna create a bandpass butherworth filter (third order). The documentary says: "[b,a] = butter(n,Wn,ftype) designs a lowpass, highpass, bandpass, or bandstop Butterworth filter, depending on the value of ftype and the number of elements of Wn. The resulting bandpass and bandstop designs are of order 2n."
Therefore, my I wrote my Code like:
fc_1=1000; % bottom cut off frequency
fc_2=2000; % upper cut off frequency
fs= 20000; % sample rate
Wc_1= 2*pi*fc_1/fs;
WC_2= 2*pi*fc_2/fs;
[b, a]= butter(1.5, [Wc_1 Wc_2], 'bandpass')
Sadly, Matlab says now that it expect a integer value for n (in my case 1.5). Did I understand the documentary wrong?
Thanks a lot for your help, Gerald :-)

Risposte (2)

Ced
Ced il 16 Mar 2016
You understood the documentation correctly.
Intuitively, bandpass and bandstop filters are symmetric around their cutoff frequency, hence Matlab's butter function only supports an even number of poles. Low and high pass filters do not have this restriction.
  2 Commenti
GerRu
GerRu il 16 Mar 2016
Okay... So I guess it is the same, if I conduct first a high pass (third order) and afterwards a lowpass filter?!
Ced
Ced il 16 Mar 2016
Yes, although the actual output of course depends on what the design of your two components looks like.

Accedi per commentare.


Star Strider
Star Strider il 16 Mar 2016
Use the buttord function to calculate the optimal order and passband for your filter. My filter design procedure is in: How to design a lowpass filter for ocean wave data in Matlab?
  2 Commenti
GerRu
GerRu il 16 Mar 2016
Thanks for the quick answer. The problem is, that the order and the bandpass is already specified.... So it has to be the third order... :/
Star Strider
Star Strider il 16 Mar 2016
My pleasure.
Use 3 for the order.
Also, you have to normalise your frequencies by the Nyquist frequency, which is half the sampling frequency, not the sampling frequency itself. The Nyquist frequency is the highest resolvable frequency in a sampled signal.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by