# Don't understand coefficients in MATLAB "butter" low pass result

I don't unstand the nature of the output in Matlab's "butter" command. Calling

[b,a] = butter(4, 0.5, 'low');


gives me two vectors, which the documentation says are b for numerator, and a for denominator, of the transfer function.

However plotting the frequency response of this transfer function with freqz() does not give me what I expected.

If I plot

freqz(b./a)


I see:

This is not a low pass filter, this is some sort of band stop filter suppressing the middle frequencies. However if I plot

freqz(b)


I see what looks like the low pass filter I was hoping for:

So if I want to use a Butterworth filter to low pass my data, do I only use b? And if so what is the point of a?

• Correct: freqz(b,a), i.e., you should supply both the numerator and denominator to freqz. Commented Mar 9, 2015 at 12:18

You are using wrong syntax. You should call freqz function as:

freqz(b,a)


You do not divide any coefficients. In case of non-recursive filters (FIR) you use only coefficients stored in b vector. When you are using the recursive LCCDE (Linear Constant Coefficients Difference Equation) (mostly IIR filters) then you need also the a vector. I suggest you to set a to 1 if you use non-recursive FIR filters.

You should also watch out for numerical problems with transfer function representation as mentioned in final paragraph of this manual entry and this answer. It's always safer to use z-p-k representation.

• That is: RTGM!!!
– Peter K.
Commented Mar 9, 2015 at 12:34
• I always say: if you want to learn MATLAB, there is no better source than F1. They have the best manual ever.
– jojeck
Commented Mar 9, 2015 at 12:36
• Blimey, I wasn't doing my division in the Fourier domain. Now I see why that doesn't work! Commented Mar 10, 2015 at 10:01