0
votes

I am asked to design a digital low pass butterworth filter using MATLAB with the following specs :

  1. cutoff frequency of 1.5 kHz
  2. 10 dB stopband attenuation at 3 kHz
  3. sampling frequency of 8 kHz

I have calculated the order of the filter to be 1.57. As we know we need to ceil this value to ensure that the filter satisfies the specs. However, in matlab I am using

buttord()

This function returns the lowest order which will be one in this case. So how do I return the highest order instead of returning the lowest order ?

1

1 Answers

3
votes

There is no highest order butterworth filter since any order greater than or equal to the result returned by buttord can satisfy the specs.

Since the sampling rate is 8kHz then the Nyquist frequency is 4kHz. If you assume 3dB passband ripple (which is standard), then calling buttord we get

Fn = 4000;
Wp = 1500/Fn;
Ws = 3000/Fn;
Rp = 3;
Rs = 10;
ord = buttord(Wp, Ws, Rp, Rs)

which gives ord = 1. Using the filter designer we can design such a filter and we see that indeed an order 1 butterworth filter exists which matches the specifications.

enter image description here

If you export the filter to your workspace (assuming you saved into SOS and G variables) then you can plot using freqz as follows

[b,a] = sos2tf(SOS,G);
freqz(b,a,[],8000);

If you want to design a filter using butter then you can use

[n,Wn] = buttord(Wp, Ws, Rp, Rs);
[b,a] = butter(n,Wn);
freqz(b,a,[],8000);

which results in exactly 10dB attenuation at the start of the stopband and less than 3dB attenuation in passband.

enter image description here