0% found this document useful (0 votes)
52 views

Experiment 4 Analog Filter Design: Ece2006 DSP Lab WINTER 2021

This document contains instructions for an analog filter design lab experiment. It includes code to design and analyze the frequency response of Butterworth, Chebyshev type-I, and Chebyshev type-II low-pass, high-pass, band-pass, and band-stop filters. For each filter type, the code calculates the filter coefficients, computes the frequency response, and plots the gain response on a bode plot with labeled axes and titles.

Uploaded by

k
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)
52 views

Experiment 4 Analog Filter Design: Ece2006 DSP Lab WINTER 2021

This document contains instructions for an analog filter design lab experiment. It includes code to design and analyze the frequency response of Butterworth, Chebyshev type-I, and Chebyshev type-II low-pass, high-pass, band-pass, and band-stop filters. For each filter type, the code calculates the filter coefficients, computes the frequency response, and plots the gain response on a bode plot with labeled axes and titles.

Uploaded by

k
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/ 7

ECE2006 DSP LAB WINTER 2021

EXPERIMENT 4
ANALOG FILTER DESIGN
ECE2006 DSP LAB WINTER 2021
ECE2006 DSP LAB WINTER 2021

Butterworth Filter
Fp=3500;Fs=4500; %Pass band and stop band edge
frequencies%
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N,wn]=buttord(Wp,Ws,0.5,30,'s');
[b,a]=butter(N,wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,1);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('LOW PASS FILTER - Gain response');
axis([0 3*Fs -60 5]);

%High Pass Filter%


Fp=3500;Fs=4500;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N,wn]=buttord(Wp,Ws,0.5,30,'s');
[b,a]=butter(N,wn,'high','s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,2);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('HIGH PASS FILTER - Gain response');
ECE2006 DSP LAB WINTER 2021

axis([0 3*Fs -60 5]);

%Band Pass Filter%


Fp=3000;Fs=6000;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N]=buttord(Wp,Ws,0.5,30,'s');
[wn]=[Wp,Ws];
[b,a]=butter(N,wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,3);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('BAND PASS FILTER - Gain response');
axis([0 3*Fs -60 5]);

%Band Stop Filter%


Fp=3000;Fs=6000;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N]=buttord(Wp,Ws,0.5,30,'s');
[wn]=[Wp,Ws];
[b,a]=butter(N,wn,'stop','s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,4);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('BAND Stop FILTER - Gain response');
axis([0 3*Fs -60 5]);

Chebychev-Type-I filter
Fp=3500;Fs=4500;%Pass band and stop band edge
frequencies%
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N,wn]=cheb1ord(Wp,Ws,0.5,30,'s');
[b,a]=cheby1(N,30,wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,1);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('LOW PASS FILTER - Gain response');
axis([0 3*Fs -60 5]);
ECE2006 DSP LAB WINTER 2021

%High Pass Filter%


Fp=3500;Fs=4500;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N,wn]=cheb1ord(Wp,Ws,0.5,30,'s');
[b,a]=cheby1(N,30,wn,'high','s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,2);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('HIGH PASS FILTER - Gain response');
axis([0 3*Fs -100 5]);

%Band Pass Filter%


Fp=3000;Fs=6000;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N]=cheb1ord(Wp,Ws,0.5,30,'s');
[wn]=[Wp,Ws];
[b,a]=cheby1(N,30,wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,3);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('BAND PASS FILTER - Gain response');
axis([0 3*Fs -100 5]);

%Band Stop Filter%


Fp=3000;Fs=6000;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N]=cheb1ord(Wp,Ws,0.5,30,'s');
[wn]=[Wp,Ws];
[b,a]=cheby1(N,30,wn,'stop','s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,4);
%figure;
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('BAND Stop FILTER - Gain response');
axis([0 3*Fs -200 5]);
ECE2006 DSP LAB WINTER 2021

Chebychev-Type-II
Fp=3500;Fs=4500;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N,wn]=cheb2ord(Wp,Ws,0.5,30,'s');
[b,a]=cheby2(N,30,wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,1);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('LOW PASS FILTER - Gain response');
axis([0 3*Fs -60 5]);

%High Pass Filter%


Fp=3500;Fs=4500;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N,wn]=cheb2ord(Wp,Ws,0.5,30,'s');
[b,a]=cheby2(N,30,wn,'high','s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,2);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('HIGH PASS FILTER - Gain response');
axis([0 3*Fs -100 5]);

%Band Pass Filter%


Fp=1000;Fs=6000;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N]=cheb2ord(Wp,Ws,0.5,30,'s');
[wn]=[Wp,Ws];
[b,a]=cheby2(N,30,wn,'s');
wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,3);
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('BAND PASS FILTER - Gain response');
axis([0 3*Fs -100 5]);

%Band Stop Filter%


Fp=3000;Fs=9000;
Wp=2*pi*Fp;Ws=2*pi*Fs;
[N]=cheb2ord(Wp,Ws,0.5,30,'s');
[wn]=[Wp,Ws];
[b,a]=cheby2(N,30,wn,'stop','s');
ECE2006 DSP LAB WINTER 2021

wa=0:(3*Ws)/511:3*Ws;
h=freqs(b,a,wa);
subplot(2,2,4);
%figure;
plot(wa/(2*pi),20*log10(abs(h)));grid
xlabel('Freq...>');ylabel('gain...>');
title('BAND STOP FILTER - Gain response');
axis([0 3*Fs -200 5]);

You might also like