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

Program 3b

This document discusses designing different types of digital filters from analog filters using the bilinear transformation method. It provides examples of designing a low bandpass filter, high bandpass filter, stopband filter, and passband filter. For each filter type, it specifies the filter order, sampling frequency, cutoff frequencies, and uses the 'butter', 'bilinear', and 'freqz' functions in MATLAB to generate the filter coefficients and plot the frequency response.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Program 3b

This document discusses designing different types of digital filters from analog filters using the bilinear transformation method. It provides examples of designing a low bandpass filter, high bandpass filter, stopband filter, and passband filter. For each filter type, it specifies the filter order, sampling frequency, cutoff frequencies, and uses the 'butter', 'bilinear', and 'freqz' functions in MATLAB to generate the filter coefficients and plot the frequency response.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

EXPERIMENT III (B)

Design a low bandpass filter from analog to digital filter using


impulse bilinear transformation method :-
n = 3 % n is a filter order

n = 3

fs = 20 % fs is a sampling frequency

fs = 20

f = 3 % f is a cut off frequency in HZ

f = 3

% For analog filters frequency must be in radians per second


fr = 2*pi*f % fr is a frequency in radians per second

fr = 18.8496

% 'butter' use for butterworth filter and 's' use for analog filter by default it gives
% low pass filter

[b,a] = butter(n,fr,'s')

b = 1×4
103 ×
0 0 0 6.6974
a = 1×4
103 ×
0.0010 0.0377 0.7106 6.6974

[bz,az] = bilinear(b,a,fs) % 'bilinear' use for bilinear transformation method

bz = 1×4
0.0420 0.1260 0.1260 0.0420
az = 1×4
1.0000 -1.2782 0.7736 -0.1594

% 'freqz' use for Frequency response of digital filter, being calculated at 1024 points

freqz(bz,az,1024,fs)

1
Design a high bandpass filter from analog to digital filter using impulse bilinear transformation
method :-

n = 3 % n is a filter order

n = 3

fs = 10 % fs is a sampling frequency

fs = 10

f = 3 % f is a cut off frequency in HZ

f = 3

% For analog filters frequency must be in radians per second


fr = 2*pi*f % fr is a frequency in radians per second

fr = 18.8496

% 'butter' use for butterworth filter and 's' use for analog filter and 'high' use for
% high pass filter

[b,a] = butter(n,fr,'high','s')

b = 1×4
1 0 0 0
a = 1×4
103 ×

2
0.0010 0.0377 0.7106 6.6974

[bz,az] = bilinear(b,a,fs) % bilinear use for bilinear transformation method

bz = 1×4
0.1819 -0.5456 0.5456 -0.1819
az = 1×4
1.0000 -0.1086 0.3365 -0.0099

% 'freqz' use for Frequency response of digital filter, being calculated at 1024 points

freqz(bz,az,1024,fs)

Design a stop band filter from analog to digital filter using impulse bilinear transformation method :-

n = 3 % n is a filter order

n = 3

fs = 20 % fs is a sampling frequency

fs = 20

f1 = 3 % f1 is a first cut off frequency in HZ

f1 = 3

f2 = 6 % f2 is a second cut off frequency in HZ

f2 = 6

3
% For analog filters frequency must be in radians per second
fr1 = 2*pi*f1 % fr1 is a first frequency in radians per second

fr1 = 18.8496

fr2 = 2*pi*f2 % fr2 is a second frequency in radians per second

fr2 = 37.6991

% 'butter' use for butterworth filter and 's' use for analog filter and 'stop' use for
% stopband filter

[b,a] = butter(n,[fr1,fr2],'stop','s')

b = 1×7
108 ×
0.0000 0 0.0000 0 0.0151 0 3.5884
a = 1×7
108 ×
0.0000 0.0000 0.0000 0.0006 0.0202 0.1904 3.5884

[bz,az] = bilinear(b,a,fs) % bilinear use for bilinear transformation method

bz = 1×7
0.5262 -1.2153 2.5143 -2.6707 2.5143 -1.2153 0.5262
az = 1×7
1.0000 -1.8303 2.8943 -2.4982 1.9101 -0.7728 0.2766

% 'freqz' use for Frequency response of digital filter, being calculated at 1024 points

freqz(bz,az,1024,fs)

4
Design a pass band filter from analog to digital filter using impulse bilinear transformation method :-

n = 3 % n is a filter order

n = 3

fs = 20 % fs is a sampling frequency

fs = 20

f1 = 3 % f1 is a first cut off frequency in HZ

f1 = 3

f2 = 6 % f2 is a second cut off frequency in HZ

f2 = 6

% For analog filters frequency must be in radians per second


fr1 = 2*pi*f1 % fr1 is a first frequency in radians per second

fr1 = 18.8496

fr2 = 2*pi*f2 % fr2 is a second frequency in radians per second

fr2 = 37.6991

% 'butter' use for butterworth filter and 's' use for analog filter and 'bandpass' use for
% pass band filter

5
[b,a] = butter(n,[fr1,fr2],'bandpass','s')

b = 1×7
103 ×
0 0 0 6.6974 0 0 0
a = 1×7
108 ×
0.0000 0.0000 0.0000 0.0006 0.0202 0.1904 3.5884

[bz,az] = bilinear(b,a,fs) % bilinear use for bilinear transformation method

bz = 1×7
0.0183 -0.0000 -0.0549 -0.0000 0.0549 0.0000 -0.0183
az = 1×7
1.0000 -1.8303 2.8943 -2.4982 1.9101 -0.7728 0.2766

% 'freqz' use for Frequency response of digital filter, being calculated at 1024 points

freqz(bz,az,1024,fs)

You might also like