I want to design a band pass Chebyshev Type II filter using analog prototyping. The order of filter is 20 with a value of 60 dB stop band attenuation and 0.75 dB pass band ripple where, Pass band edge = 800 Hz Stop band edge = 2000 Hz Sampling frequency = 6000

My Matlab code is below

clc;  close all;   clear all;
Rp = 0.75;    Rs = 60;
fp = 800;
fs = 2000;
Fs = 6000;

fn = Fs/2;     % nyquist frequency
wp = fp/fn;     % normalized Pass band corner frequency
ws = fs/fn;     % normalized Stop band corner frequency

[n,Wn] = cheb2ord(wp,ws,Rp,Rs);
[num,den] = cheby2(20,Rs,Wn);

I have also attached snapshot of output which shows that output frequency plot looks like low pass,but i think ,why output plot is not band pass?How can it look band pass?

enter image description here


2 Answers 2


You're using the function cheb2ord in the wrong way. Assuming that your lower stopband edge is $800$ Hz and your upper stopband edge is $2000$ Hz (note that a bandpass filter has two stopband edges, as well as two passband edges), and if the sampling frequency is $6000$ Hz, then the following command should do what you intended to do:

[b, a] = cheby2(10, 60, [4, 10]/15);

Note that for bandpass and bandstop filters, the resulting filter order is twice the number you use in the call to cheby2.

  • 1
    $\begingroup$ it might be nice to explain where the numbers "10", "60", "4", "10", and "15: come from when the relevant parameters are 6000 Hz, 800 Hz, 2000 Hz.. $\endgroup$ Jul 12, 2020 at 2:49
  • $\begingroup$ @robertbristow-johnson: Maybe a bit too nice, considering that this might be part of some homework project? Also, from the OP's code it appears that computing normalized edge frequencies is not the problem here. Concerning the value for the filter order ($10$), I tried to explain this choice in the last sentence of my answer. $\endgroup$
    – Matt L.
    Jul 12, 2020 at 12:33
  • $\begingroup$ @MattL. Please believe me ,it is not part of any home work, i understood "10" and "60", but still confused why you used [4,10]/15 ?? $\endgroup$
    – DSP_CS
    Jul 12, 2020 at 17:24
  • $\begingroup$ @engr: These are exactly the same value you used in your code: fp/fn, fs/fn $\endgroup$
    – Matt L.
    Jul 12, 2020 at 17:55
  • $\begingroup$ ok thanks, you re wrote them in lowest form by cancelling common factor $\endgroup$
    – DSP_CS
    Jul 12, 2020 at 18:00

What variables n and Wn holds when returned from cheb2ord and, what you do with these values? I.e. check documentation for: cheb2ord and cheby2.


Your Answer

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

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