Professional Documents
Culture Documents
Experiment: 10
Experiment: 10
Experiment: 10
Date: 6/11/2019
Aim:
i. Design a Butterworth low pass filter, high pass filter, band pass filter,
band stop filter for given specifications:
a. low pass filter
0.9 ≤ |H(𝑒 )| ≤ 1 0≤w≤
|H(𝑒 )| ≤ 0.2 ≤w≤𝜋
b. high pass filter
0.9 ≤ |H(𝑒 )| ≤ 1 ≤w≤𝜋
|H(𝑒 )| ≤ 0.2 0≤w≤
c. band pass filter
0.9 ≤ |H(𝑒 )| ≤ 1 ≤w≤
|H(𝑒 )| ≤ 0.2 0≤w≤ and w ≥
d. band stop filter
0.9 ≤ |H(𝑒 )| ≤ 1 0≤w≤ and w ≥
|H(𝑒 )| ≤ 0.2 ≤w≤
ii. Design a Butterworth low pass filter for n=3,15,45,60 for given
specifications:
0.9 ≤ |H(𝑒 )| ≤ 1 0≤w≤
|H(𝑒 )| ≤ 0.2 ≤w≤𝜋
Inbuilt functions:
1. butter
Wp = pass band corner frequency Wp, the cutoff frequency, is a scalar or a two-element
vector with values between 0 and 1, with 1 corresponding to the normalized Nyquist
frequency, π radians per sample.
Ws = stop band corner frequency Ws, is a scalar or a two-element vector with values
between 0 and 1, with 1 corresponding to the normalized Nyquist frequency.
MATLAB Code:
i.
clc
close all
clear all
dp = 0.9;
ds = 0.2;
rp = -20*log10(dp);
rs = -20*log10(ds);
%LPF
wp = pi/2;
ws = 3*pi/4;
[n,wn] = buttord(wp/pi,ws/pi,rp,rs);
[b,a] = butter(n,wn);
figure();
freqz(b,a,0:0.01:pi);
%HPF
ws = pi/2;
wp = 3*pi/4;
[n,wn] = buttord(wp/pi,ws/pi,rp,rs);
[b,a] = butter(n,wn,'high');
figure();
freqz(b,a,0:0.01:pi);
%BPF
ws = [pi/20 pi/4];
wp = [pi/10 pi/8];
[n,wn] = buttord(wp/pi,ws/pi,rp,rs);
[b,a] = butter(n,wn);
figure();
freqz(b,a,0:0.01:pi);
%BSF
ws = [pi/20 pi/4];
wp = [pi/10 pi/8];
[n,wn] = buttord(wp/pi,ws/pi,rp,rs);
[b,a] = butter(n,wn,'stop');
figure();
freqz(b,a,0:0.01:pi);
Results:
Matlab code:
ii.
clc
close all
clear
%LPF
wp = pi/2;
ws = 3*pi/4;
dp = 0.9;
ds = 0.2;
rp = -20*log10(dp);
rs = -20*log10(ds);
[n,wn] = buttord(wp/pi,ws/pi,rp,rs);
n1=3;
n2=15;
n3=45;
n4=60;
[b1,a1] = butter(n1,wn);
[Hn1,Wn1] = freqz(b1,a1,0:0.01:pi);
[b2,a2] = butter(n2,wn);
[Hn2,Wn2] = freqz(b2,a2,0:0.01:pi);
[b3,a3] = butter(n3,wn);
[Hn3,Wn3] = freqz(b3,a3,0:0.01:pi);
[b4,a4] = butter(n4,wn);
[Hn4,Wn4] = freqz(b4,a4,0:0.01:pi);
subplot(211)
plot( Wn1/pi,20*log10(abs(Hn1)), Wn2/pi,20*log10(abs(Hn2)),
Wn3/pi,20*log10(abs(Hn3)), Wn4/pi,20*log10(abs(Hn4)));
legend('n=3','n=15','n=45','n=60');
title('magnitude plot')
subplot(212)
plot( Wn1/pi,phase(Hn1), Wn2/pi,phase(Hn2), Wn3/pi,phase(Hn3),
Wn4/pi,phase(Hn4));
legend('n=3','n=15','n=45','n=60');
title('phase plot');
Result:
Conclusion:
From this experiment we can conclude that for butterworth filter there is a smooth
response in pass band and ripples in stop band. As the order of filter increases the
filter response becomes close to an ideal low pass filter.