MATLAB: Matlab code and filterDesigner give different plots for the same setting of Chebyshev II bandpass filter

chebyshev filtertype ii

The image below shows the settings in the filterDesigner by using Chebyshev type II bandpass filter and the plots.
The image below shows my hand code in MATLAB using the same settings for Chebyshev II bandpass filter.
The plots are below and look different from the one in filterDesigner window:
Are there something wrong in my hand code of the MATLAB?

Best Answer

  • I suspect that filterDesigner uses the second-order-section implementation of the filter.
    You should, as well.
    [b,a] = cheby2( ... );
    [z,p,k] = cheby2( ... );
    [sos,g] = zp2sos(z,p,k);
    freqz(sos, 2^16, Fs)
    (where ‘Fs’ is the sampling frequency) and your filter Bode plot using freqz will likely approximate the filterDesigner implementation.