lowpass digital Butterworth filter

11 views (last 30 days)
Piya
Piya on 5 Mar 2011
I have been looking at the function butter ([B,A] = BUTTER(N,Wn)) to design an Nth order lowpass digital Butterworth filter. The cutoff frequency, Wn, must be 0 < Wn < 1, with 1 corresponding to half the sample rate (Nyquist frequency). Why can’t the cutoff frequency be the Nyquist frequency so that Wn=1?
For example I get the following error for a 2nd order lowpass digital Butterworth filter with a cutoff frequency corresponding to half the sample rate: [b,a] = butter(2,1)
??? Error using ==> butter at 41
The cutoff frequencies must be within the interval of (0,1).
Thanks.

Answers (3)

Jan
Jan on 8 Mar 2011
Which filter parameters do you get for Wn=1?
[B, A] = butter(2, 1-eps);
>> B = [1, 2, 1]
A = [1, 2, 0.9999999999999999]
Then guess what you would get for "butter(2, 1)" and use it for filtering:
x = rand(1, 1000);
y = filter([1,2,1], [1,2,1], x);
Now inspect the effects of filtering:
x - y
>> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
So you can obtain parameters for a lowpass Butterworth filter at the Nyquist frequency (but now with Matlab's BUTTER), and you can apply this filter also. But most likely you don't want to do this and therefore Matlab shows an error.
A WARNING might be better, but I assume that there are numerical reasons for an error like an division by zero.
  2 Comments
Paulo Silva
Paulo Silva on 8 Mar 2011
Selecting Wn=1 is like riding a bike over a wall, you might fall for one side or the other, that's why you can't select exactly 1 for Wn. The numeric reasons are all inside the book Digital Filter Design T Parks, C Burrus (Wiley, 1987), that's the one I see quoted on the butter function code.
Jan
Jan on 8 Mar 2011
If you comment out the line, which stops BUTTER with an error in case of Wn=1, you get the above shown integer values for the filter parameters. If you insert them in the direct form II algorithm of FILTER, you see that the Wn=1 lowpass filter replies the original signal, while the corresponding highpass filter replies zeros only. I do not see numerical instabilities in the algorithm, therefore I do not agree that this kind of filter is like riding a bike on a wall. I think it's more like driving a roller compactor over a wall.

Sign in to comment.


Paulo Silva
Paulo Silva on 5 Mar 2011
The transition from pass band to stop band occurs at a normalized frequency Wn=1
Digital Filter Design T Parks, C Burrus (Wiley, 1987)

Piya
Piya on 8 Mar 2011
I realise that this is more of a theory question, but could you explain why the digital filter has to be designed with a cut off frequency less than the Nyquist frequency, why can’t it be designed with a cut off frequency equal to the Nyquist frequency?

Community Treasure Hunt

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

Start Hunting!