1
$\begingroup$

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

enter image description here

Response for Chebyshev I filter

enter image description here

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

1 Answer 1

1
$\begingroup$

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)));
$\endgroup$

Your Answer

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

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