You are on page 1of 7

Table of Contents

LAB 6 IIR Filter..........................................................................................................................................1


Part B: Chebysev filter design.....................................................................................................................1
Example 1 Butterworth filter design...........................................................................................................1
Example 2.....................................................................................................................................................3

LAB 6 IIR Filter


%Name of Student: Shweta Sonkusare
%Roll No.: 222
%Section: C
%Semester: VI
%Course Name: DIGITAL SIGNAL PROCESSING LAB
%Course Code: ET2352
%Course Teacher Name: Prof. M S DORLE
%Date of Performance: 19/03/2021
%Department of Electronics and Telecommunication YCCE,NAGPUR
clc;clear;close all;

Part B: Chebysev filter design


Example 1 Butterworth filter design
%For data sampled at 1000 Hz, design a lowpassChebyshev type I filter
with less than 3 dB of
%ripple in the passband defined from 0 to 40 Hz and at least 60 dB of
ripple in the stopband
%defined from 150 Hz to the Nyquist frequency (500 Hz):

%Code:
Fs=1000;
Wp = 2*40/Fs; Ws = 2*150/Fs;
[N,Wc] = cheb1ord(Wp,Ws,3,60);
sprintf('Order of Butterworth Lowpass Filter is N=%d ',N)
sprintf('Cut-off Frequency of Butterworth Lowpass Filter is Wc=%f
',Wc)
[b,a] = cheby1(N,3,Wp);
zplane(b,a)
title('Pole-Zero Plot of System function H(z)')
[H,f]=freqz(b,a,512,Fs);
figure;
plot(f,abs(H))
title('Frequency Response of LP Digital Butterworth Filter')
figure;
freqz(b,a,512,Fs)

1
ans =

'Order of Butterworth Lowpass Filter is N=4 '

ans =

'Cut-off Frequency of Butterworth Lowpass Filter is Wc=0.080000 '


Example 2
Design a bandpassChebyshev type I filter with a passband of 60 Hz to 200 Hz, with less than 3

%dB of ripple in the passband, and 40 dB attenuation in the stopbands


that are 50 Hz wide on
%both sides of the passband:

%Code:
Fs=1000;
Wp1 = 2*60/Fs;
Wp2 = 2*200/Fs;
Ws1 = 2*10/Fs;
Ws2 = 2*250/Fs;
Wp=[Wp1,Wp2];
Ws=[Ws1,Ws2];
[N,Wc] = cheb1ord(Wp,Ws,3,60);
sprintf('Order of Butterworth Lowpass Filter is N=%d ',N)
sprintf('Cut-off Frequency of Butterworth Lowpass Filter is Wc=%f
',Wc)
[b,a] = cheby1(N,3,Wp);
zplane(b,a)
title('Pole-Zero Plot of System function H(z)')
[H,f]=freqz(b,a,512,Fs);
figure;
plot(f,abs(H))
title('Frequency Response of LP Digital Butterworth Filter')
figure;
freqz(b,a,512,Fs)

%%EXAMPLE 3
% Design a bandpassChebyshev type I filter with a passband of 60 Hz to
200 Hz, with less than 3
%dB of ripple in the passband, and 40 dB attenuation in the stopbands
that are 50 Hz wide on
%both sides of the passband:

%Code:
Fs=1000;
Wp1 = 2*60/Fs;
Wp2 = 2*200/Fs;
Ws1 = 2*10/Fs;
Ws2 = 2*250/Fs;
Wp=[Wp1,Wp2];
Ws=[Ws1,Ws2];
[N,Wc] = cheb2ord(Wp,Ws,3,60);
sprintf('Order of Butterworth Lowpass Filter is N=%d ',N)
sprintf('Cut-off Frequency of Butterworth Lowpass Filter is Wc=%f
',Wc)
[b,a] = cheby2(N,3,Wp);
zplane(b,a)
title('Pole-Zero Plot of System function H(z)')
[H,f]=freqz(b,a,512,Fs);
figure;
plot(f,abs(H))
title('Frequency Response of LP Digital Butterworth Filter')
figure;
freqz(b,a,512,Fs)

ans =

'Order of Butterworth Lowpass Filter is N=8 '

ans =

'Cut-off Frequency of Butterworth Lowpass Filter is


Wc=0.120000 Cut-off Frequency of Butterworth Lowpass Filter is
Wc=0.400000 '

ans =

'Order of Butterworth Lowpass Filter is N=8 '

ans =

'Cut-off Frequency of Butterworth Lowpass Filter is


Wc=0.020000 Cut-off Frequency of Butterworth Lowpass Filter is
Wc=0.500000 '
Published with MATLAB® R2021a

You might also like