0% found this document useful (0 votes)
47 views7 pages

Experiment: 10

The document describes an experiment to design Butterworth filters including low pass, high pass, band pass, and band stop filters based on given specifications. It also designs Butterworth low pass filters for different orders (n=3, 15, 45, 60) to analyze the effect of order on filter response. The key steps involve using the buttord and butter functions in MATLAB to design the filters and plotting the magnitude and phase responses to analyze the results. The conclusion is that higher order Butterworth filters have a smoother response in the passband and ripples in the stopband, approaching an ideal low pass filter response.

Uploaded by

Vishal Manwani
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)
47 views7 pages

Experiment: 10

The document describes an experiment to design Butterworth filters including low pass, high pass, band pass, and band stop filters based on given specifications. It also designs Butterworth low pass filters for different orders (n=3, 15, 45, 60) to analyze the effect of order on filter response. The key steps involve using the buttord and butter functions in MATLAB to design the filters and plotting the magnitude and phase responses to analyze the results. The conclusion is that higher order Butterworth filters have a smoother response in the passband and ripples in the stopband, approaching an ideal low pass filter response.

Uploaded by

Vishal Manwani
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

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

[b,a] = butter(n,Wn,ftype) designs a lowpass, highpass, bandpass, or bandstop


Butterworth filter, depending on the value of ftype and the number of elements of Wn.
The resulting bandpass and bandstop designs are of order 2n.
2. buttord

[n,Wn] = buttord(Wp,Ws,Rp,Rs) returns the lowest order, n, of the digital Butterworth


filter with no more than Rp dB of passband ripple and at least Rs dB of attenuation in the
stopband. The scalar (or vector) of corresponding cutoff frequencies, Wn, is also
returned. Use the output arguments n and Wn in butter where,

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.

Rp = pass band ripple in decibels.

Rs = stop band attenuation in decibels.

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:

1. low pass filter


2. high pass filter

3. band pass filter


4. band stop filter

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.

You might also like