matlabsignal-processingdigital-filter

Phase plot is not generated for entire range of frequencies for butterworth low pass filter


I want to design a Butterworth low pass filter and see its magnitude and phase response. I tried the following code.

n = 8;     % order of filter
fs = 1000;   % sampling frequency
fc = 20;     % cutoff frequency
[b a]= butter(n,fc/(fs/2),'low');   % design low pass filter
freqz(b,a,1024,fs);

I am getting the following plot: Magnitude and Phase plot

As can be seen, it doesn't give phase plot for all frequency range (there is no phase plot for frequencies in between 300 to 500 Hz). Please help me in understanding the cause of this and how to rectify this?


Solution

  • Yes, this looks like a bug. But you can make same plot 'by hand':

    [H,w] = freqz(b,a,1024,fs);
    plot(w, unwrap(angle(H)));