Different frequency responses using [z,p,k] method and [b,a] for 2nd order elliptical filter

3 views (last 30 days)
Hi, I am designing an elliptical filter and using 2nd order. My code is below, however, both of them display different frequency responses. Why is that so? Am I doing something wrong here? However, when I am plotting for 4th order, both responses are same.
%Filter design
% [b,a]=ellip(2,20,25,[2000 9000]/(fs/2),'bandpass');
[z,p,k] = ellip(2,20,25,200/210,'high');
sos = zp2sos(z,p,k);

Accepted Answer

Star Strider
Star Strider on 19 Jul 2021
You are doing everything correctly, however you only need to use the second-order-section (‘sos’) representation, since it essentially guarantees an efficient, stable filter. Transfer-function implementations can produce unstable or unreliable results.
What may be confusing the issue however are the arguments to the ellip function. This designs a second-order filter with a passband attenuation of 20 dB and a stopband attenuation of 25 dB. It may be worth reconsidering those values in order to get a usable filter. I suggest that you start with the ellipord function, and go from there.
Fs = 420;
[z,p,k] = ellip(2,20,25,200/210,'high');
[sos,g] = zp2sos(z,p,k);
freqz(sos, 2^16, Fs)

Sign in to comment.

More Answers (1)

Paul on 19 Jul 2021
Edited: Paul on 19 Jul 2021
If fvtool is like freqz, you need to make sure that the sos input has more than one row. Otherwise, the input might not be interpreted as an sos input. Here's an example with freqz.
[z,p,k] = ellip(2,20,25,200/210,'high');
[sos,g] = zp2sos(z,p,k);
freqz([sos;[g 0 0 1 0 0]]) % add another section that is gain g for the expected response

Sign in to comment.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!