0% found this document useful (0 votes)
55 views5 pages

EXPERIMENT 7: Design The Low Pass Filter, The High Pass Filter, and The Band Pass Filter With Infinite Impulse Response

This document describes designing low pass, high pass, and band pass filters with infinite impulse response (IIR). It uses Octave functions to design Butterworth, Chebyshev type 1 and 2, and elliptic filters based on passband, stopband, ripple, and attenuation specifications. Frequency responses are plotted for a low pass example and band pass example, comparing the different filter types and showing the Butterworth, Chebyshev, and elliptic filters meeting the given design specifications.

Uploaded by

idk bruh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views5 pages

EXPERIMENT 7: Design The Low Pass Filter, The High Pass Filter, and The Band Pass Filter With Infinite Impulse Response

This document describes designing low pass, high pass, and band pass filters with infinite impulse response (IIR). It uses Octave functions to design Butterworth, Chebyshev type 1 and 2, and elliptic filters based on passband, stopband, ripple, and attenuation specifications. Frequency responses are plotted for a low pass example and band pass example, comparing the different filter types and showing the Butterworth, Chebyshev, and elliptic filters meeting the given design specifications.

Uploaded by

idk bruh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

EXPERIMENT 7: Design the Low pass filter, the high pass filter, and the band

pass filter with infinite impulse response


THEORY:
Although, in Octave these steps are automatically taken care of by a set of functions. These
functions take the passband frequency, stop band frequency, stop band attenuation, type of filter
such as Butterworth, Chebyshev etc as inputs and follow the above-mentioned steps to design the
digital IIR filters with given specifications.

Programming & Results:


clear
close all
pkg load signal
% Specifications:
% Passband 0 to 0.2pi rads, gain between 1 and 0.9
% Stopband 0.3pi to pi rads, atten 0.001 = -60 dB
%
% Compare Butterworth, Chebyshev I & II, and elliptic designs.
passband = 0.2*pi/pi; % convert to normalized frequency
stopband = 0.3*pi/pi;
passrip = -20*log10(0.9); % ripple in positive dB
stopatten = -20*log10(0.001); %stopband attenuation in positive dB
% Find order and natural frequency to meet these specs

[Nb, Wnb] = buttord(passband, stopband, passrip, stopatten); % Butterworth filter


[Nc1, Wnc1] = cheb1ord(passband, stopband, passrip, stopatten); % Cheby 1 filter
[Nc2, Wnc2] = cheb2ord(passband, stopband, passrip, stopatten); % Cheby 2 filter
[Ne, Wne] = ellipord(passband, stopband, passrip, stopatten); % Elliptic filter

% Now use the order and frequencies just identified to design these filters
% by finding their difference equation coefficients

[Bb,Ab] = butter(Nb, Wnb);


[Bc1,Ac1] = cheby1(Nc1,passrip,Wnc1);
[Bc2,Ac2] = cheby2(Nc2,stopatten,Wnc2);
[Be,Ae] = ellip(Ne,passrip,stopatten,Wne);

% Display frequency responses


[Hb,W]= freqz(Bb,Ab,2048);
[Hc1,W]= freqz(Bc1,Ac1,2048);
[Hc2,W]= freqz(Bc2,Ac2,2048);
[He,W]= freqz(Be,Ae,2048);
subplot(2,2,1);plot(W/pi,20*log10(abs(Hb)));
axis([0 1 -80, 5])
ylabel('Gain (dB)')
xlabel('Normalized Frequency (\times \pi rad/sample)')
grid on
title(['Butterworth Filter, Order = ',num2str(Nb)])
subplot(2,2,2);plot(W/pi,20*log10(abs(Hc1)));
axis([0 1 -80, 5])
ylabel('Gain (dB)')
xlabel('Normalized Frequency (\times \pi rad/sample)')
grid on
title(['Chebyshev Filter type 1, Order = ',num2str(Nc1)])
subplot(2,2,3);plot(W/pi,20*log10(abs(Hc2)));
axis([0 1 -80, 5])
ylabel('Gain (dB)')
xlabel('Normalized Frequency (\times \pi rad/sample)')
grid on
title(['Chebyshev Filter type 2, Order = ',num2str(Nc2)])
subplot(2,2,4);plot(W/pi,20*log10(abs(He)));
title(['Elliptic Filter, Order = ',num2str(Ne)])
axis([0 1 -80, 5])
ylabel('Gain (dB)')
xlabel('Normalized Frequency (\times \pi rad/sample)')
grid on
title(['Elliptical filter, Order = ',num2str(Ne)])

%% Case 2: Bandpass filter


%
% Specifications:
% Passband 0.4pi to 0.6pi rads, gain 0.95 to 1
% Stopband 0 to 0.2pi and 0.8pi to pi rads, atten 0.01 = 40 dB
%
% Compare Butterworth and elliptic filters

passband = [ 0.4*pi 0.6*pi]/pi; % convert to normalized frequency


stopband = [ 0.2*pi 0.8*pi]/pi;
passrip = -20*log10(0.95); % ripple in dB
stopatten = -20*log10(0.01); %stopband attenuation in dB
[Ne,Wne] = ellipord(passband,stopband,passrip,stopatten);
[Be,Ae] = ellip(Ne,passrip,stopatten,Wne);
[Nb,Wnb] = buttord(passband,stopband,passrip,stopatten);
[Bb,Ab] = butter(Nb,Wnb);
figure
[Hb,W]= freqz(Bb,Ab,2048);
[He,W]= freqz(Be,Ae,2048);
subplot(2,1,1);plot(W/pi,20*log10(abs(Hb)));
axis([0 1 -80, 5])
ylabel('Gain (dB)')
xlabel('Normalized Frequency (\times \pi rad/sample)')
grid on
title(['Butterworth Filter, Order = ',num2str(Nb)])
subplot(2,1,2);plot(W/pi,20*log10(abs(He)));
title(['Elliptic Filter, Order = ',num2str(Ne)])
axis([0 1 -80, 5])
ylabel('Gain (dB)')
xlabel('Normalized Frequency (\times \pi rad/sample)')
grid on
title(['Elliptical filter, Order = ',num2str(Ne)])

Figure 1: Comparison of various IIR low pass filters


Figure 2: Comparison of various IIR band pass filters

Conclusion:

You might also like