# IIR Filter Design Issues : MATLAB

I am designing an IIR Filter with the following designs constraints:

1. Passband $(0.75\pi,\pi)$
2. Stopband $(0,0.70\pi)$
3. No more than $0.5$ % ripple in the passband
4. No less than $40$ dB attenuation in the stopband

Using the designfilt command I am able to design the filter.

However when I am using the following code for the "Butteworth" filter I do not get any Phase response. The magnitude response is fine, but the Phase values have NaN values - "Not a Number". The same codes are able to design for "Chebyshev" and "Elliptic" filters.

Wp = 0.75;
Ws = 0.7;
Rp = 20*log10(1.005);
Rs = 40;

[Nb, Wnb] = buttord(Wp, Ws, Rp, Rs); % Nb: minimum order; Wnb: cutoff frequency
[Zb, Pb, Kb] = butter(Nb, Wnb,'high'); % Zb : zeros ; Pb : Poles , Kb : gain

SOSb = zp2sos(Zb, Pb, Kb);

freqz(SOSb)


Response for Butterworth Filter Response for Chebyshev I filter • I think its due to the order of the butterworth filter. Its 34 { because of the sharp transition width }. Nov 25, 2015 at 21:22
• Have you tried [b,a]=butter(Nb, Wnb,'high'); and freqz(b,a)? Nov 26, 2015 at 9:53
• Yeah I had Matt. It also did not work. Returned phase values only for half of the frequencies. Nov 28, 2015 at 3:01

This would appear to be a bug in the freqz implementation. I didn't dig enough to figure out why but even this doesn't work:

freqz(SOSb(1:2,:));


Even though angle(freqz(SOSb(1:2,:))) returns a legitimate result.

But I found this as a workaround:

[h,f,s]=freqz(SOSb);
freqzplot(h,f,s);


Unfortunately freqzplot is being obsoleted so you might have to resort to:

plot(angle(freqz(SOSb)));