I have a butterworth filter in MATLAB:

[B, A] = butter( 2, 3000/16000*2, 'high' );

I plot it in two ways:

  • using freqz:

    [h,w] = freqz(B,A,8000);

  • and using fvtool:

    h = fvtool(B,A);
    h.Analysis = 'phase';
    h.Fs = 16000;
    h.FrequencyRange='[-Fs/2, Fs/2)';

First plot gives me linear phase, and second one not.

Why do I get different plots?

  • $\begingroup$ plot(w) only plots the frequencies while h is the response. Same mistake as in your previous question. $\endgroup$
    – msm
    Commented Mar 28, 2017 at 7:11
  • $\begingroup$ yes, goti it, thanks. w are only x-axis frequencies, phase needs to be calculated from the complex amplitudes. thanks. $\endgroup$
    – Danijel
    Commented Mar 28, 2017 at 7:30

1 Answer 1


Citing the help output of freqz:

[H,W] = freqz(B,A,N) returns the N-point complex frequency response
vector H and the N-point frequency vector W in radians/sample of
the filter.

So, your output is not amplitude and phase, but (complex) transfer function and frequency. Hence, to plot the phase using freqz you need to use

plt(w, angle(h));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.