MATLAB Answers

Confusion implementing chebyshev type 2 band pass filter in matlab

2 views (last 30 days)
ABTJ
ABTJ on 11 Jul 2020
Commented: Haseeb Ahmed on 28 Apr 2021
I want to implement chebyshev type 2 band pass filter in matlab;actually i am not getting band pass oytput,output looks like low pass
My code is below
% 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
clc; close all; clear all;
Rp = 0.75; Rs = 60;
fp = 800;
fs = 2000;
Fs = 6000;
fn = Fs/2; % nyquist frequency
wp = fp/fn; % Pass band corner frequency
ws = fs/fn; % Stop band corner frequency
[n,Wn] = cheb2ord(wp,ws,Rp,Rs);
[num,den] = cheby2(20,Rs,Wn);
freqz(num,den,512,Fs);
I have also attached snapshot of output which shows that output frequency plot looks like low pass,
  1 Comment
Haseeb Ahmed
Haseeb Ahmed on 28 Apr 2021
Just use cheby2 commands by putting cut off frequiencies in square box, and your issue will be solved.

Sign in to comment.

Answers (1)

Haseeb Ahmed
Haseeb Ahmed on 28 Apr 2021
Edited: Haseeb Ahmed on 28 Apr 2021
[b,a] = cheby2 (10,Rs, [wp ws],'bandpass');
Use the above mentioned command, it will provide a band pass responce. Square brakets must have two cut off frequencies.
code:
clc; clear all; close all;
fp = 800; %pass band edge
fs = 2000; %stop band edge
Rp = 0.75; % pass band ripple
Rs = 60; % stop band attenuation
fsampling = 6000; % sampling frequency
wp=2*fp/fsampling ; % convert to radians per second
ws=2*fs/fsampling ; % convert to radians per second
n = 10 ; % order always 2n for band pass
[b,a] = cheby2 (10,Rs, [wp ws],'bandpass');%designs a lowpass, highpass, bandpass,
% or bandstop Chebyshev Type II filter, depending on the value of ftype
% and the number of elements of Ws. The resulting bandpass and bandstop designs
% are of order 2n.
freqz(b,a) %frequency response of digital filter

Community Treasure Hunt

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

Start Hunting!

Translated by