Professional Documents
Culture Documents
No: 2000040230
Pre-lab Session In-Lab Session Post Lab session Viva Total Marks
work (15M) work (15M) work (10M) (10M) 50M
Remarks if any:
impulse response duration is infinite, then it is referred to as IIR filter. IIR filters have
nonlinear phase characteristic which means the output of such a filter is (most likely) a
deformed version of the input without the filtered frequency. On the other hand IIR filters
might become unstable.
Objectives:
To
The study of the basic theory of analog Butterworth filters design.
Design and implementation of analog Butterworth IIR filters.
Design and implementation of digital IIR filters using Impulse Invariance
Transformation Techniques.
1
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
Basic theory: The input output relation of a IIR digital filter is described by a
difference equation:
where and are filter coefficients, N is the order of the filter, N > M. The transfer
The design of an IIR filter for the given specifications is determining filter coefficients
The classic IIR filter design technique includes the following steps.
1. Determine the order of the analog prototype filter from the given specifications.
2. Find an analog lowpass filter with cutoff frequency of 1 rad/sec and translate this
prototype filter to the specified band configuration.
3. Transform the analog filter to the digital domain.
4. Discretize the filter.
5. Find the digital filter transfer function.
6. Plot the frequency response of both analog and digital filters.
The first step in the classical approach of IIR filter design is to determine the order of
the filter from the given specifications. The following two examples illustrate the finding
the order of low-pass and high-pass filters.
Find the order of the filter from the analog filter coefficients. Design a lowpass analog
prototype filters with cutoff frequency of 1 rad/sec.
Ex1: Design and implementation of Low Pass Filter with the following specifications:
2
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
clear;close all;clc;
format long
% Filter specifications
rp = -1.5; % Passband ripple
rs = -20; % Stopband ripple
Fp = 500; % Passband frequency in Hz
Fs= 3000; % Stopband frequency in Hz
Fsamp = 12000; % Sampling frequency
3
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
N
N =
2
Computing the cut-off frequency from the given specifications using the formula
Oc
Oc =
5.975748682891273e+03
Determining Butterworth low pass filter order and cut-off frequency using Matlab 'butter.m'
command.
4
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
[bn,an] = butter(N,Ocn,'s');
bn
bn = 1×3
0 0 1
an
an = 1×3
1.000000000000000 1.414213562373095 1.000000000000000
% Determining Analog filter transfer function with Normalized cut off
frequency
Hsn = tf(bn, an);
Hsn
Hsn =
1
-----------------
s^2 + 1.414 s + 1
figure();
subplot(2,1,1);loglog(w,mag);grid on
title('Magnitude Response of normalized transfer function');
xlabel('Frequency (rad/s)'); ylabel('Magnitude');
subplot(2,1,2);semilogx(w,phasedeg);grid on
title('Phase Response of normalized transfer function');
xlabel('Frequency (rad/s)'); ylabel('Phase (degrees)');
lines = findall(gcf,'type','line');
lines(1).Color ='blue'; lines(2).Color = 'red';
5
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
(d) Determining analog filter transfer function with desired cut off frequency.
Desired analog Butterworth filter coefficients can be derived by transforming Low pass to
% Another method
[b, a] = lp2lp(bn, an, Oc)
b =
3.570957232107679e+07
a = 1×3
6
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
107 ×
0.000000100000000 0.000845098483268 3.570957232107679
Determining analog filter transfer function with desired cut off frequency.
3.571e07
-----------------------
s^2 + 8451 s + 3.571e07
figure();
subplot(2,1,1);loglog(w,mag);grid on
title('Magnitude Response of desired transfer function');
xlabel('Frequency (rad/s)'); ylabel('Magnitude');
subplot(2,1,2);semilogx(w,phasedeg);grid on
title('Phase Response of desired transfer function');
xlabel('Frequency (rad/s)'); ylabel('Phase (degrees)');
lines = findall(gcf,'type','line');
lines(1).Color ='blue'; lines(2).Color = 'red';
Ex2: Design and implementation of High Pass Filter with the following specifications:
(a) Find the order and cut-off frequency of the Butterworth HPF filter
(b) Determine normalized Butterworth analog LPF transfer function.
(c) Find the analog Butterworth HPF transfer function with desired cut off frequency.
7
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
(d) Plot the frequency response of the desired Butterworth HPF transfer function.
clear;close all;clc;
format long
% Filter specifications
rp = -1.5;
rs = -20;
Fs = 500; % Hz
Fp= 3000; % Hz
Fsamp = 12000; % Hz
The task is to design a high pass filter. However, first we will design a low pass filter and
then transform into high pass filter. To do this, we will interchange the pass band and
stop band frequencies and find the normalized Butterworth LPF transfer function.
(a) Computing the order and cut-off frequency of Butterworth low pass filter from the given
specifications.
8
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
[N,Oc] = buttord(Os,Op,rp,rs,'s')
N =
2
Oc =
5.975748682891273e+03
N
N =
2
Oc
Oc =
5.975748682891273e+03
(b) Determining normalized Butterworth analog LPF transfer function.
1
-----------------
s^2 + 1.414 s + 1
(c) Determining the desired Butterworth analog high-pass filter transfer function: Desired analog
Butterworth filter coefficients can be derived by transforming Low pass to high pass filter,
by substituting .
9
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
1 0 0
ah
ah = 1×3
107 ×
0.000000100000000 0.000845098483268 3.570957232107679
s^2
-----------------------
s^2 + 8451 s + 3.571e07
(d) Plotting the frequency response of desired Butterworth high pass filter.
figure();
subplot(2,1,1);loglog(w,mag);grid on
title('Magnitude Response of desired transfer function');
xlabel('Frequency (rad/s)'); ylabel('Magnitude');
subplot(2,1,2);semilogx(w,phasedeg);grid on
title('Phase Response of desired transfer function');
xlabel('Frequency (rad/s)'); ylabel('Phase (degrees)');
lines = findall(gcf,'type','line');
lines(1).Color ='blue'; lines(2).Color = 'red';
10
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
Ex3: Design and implementation of IIR low pass digital filter using IIM: Design a digital
low pass Butterworth filter using impulse-invariant transformation with pass band and
stop band cut off frequencies 0.08*pi and 0.2*pi rad/sec respectively. The pass band and
stop band attenuation are -1.5 dB and -20 dB respectively.
Converting Digital Filter parameters into analog filter parameters Impulse Invariance
Method.
11
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
Determining the order and cut-off frequencies from the analog filter specifications
% Determing the order and cut-off frequency of the Butterworth low pass
filter
N = ceil((log10((10.^(0.1*abs(rs))-1)./(10.^(0.1*abs(rp))-1)))/ ...
(2*log10(Os/Op)));
N
N =
2
1
-----------------
s^2 + 1.414 s + 1
Determining Butterworth low-pass filter coefficients with desired cutoff frequency Oc.
12
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
b = 1×3
0 0 0.042956015328982
a
a = 1×3
1.000000000000000 0.293107541114116 0.042956015328982
0.04296
------------------------
s^2 + 0.2931 s + 0.04296
% Impulse-Invariant Transformation
[bz,az] = impinvar(b,a,fs);
bz
bz = 1×2
0 0.036967556921763
az
az = 1×3
1.000000000000000 -1.708841648573466 0.745941916958809
0.03697
----------------------
z^2 - 1.709 z + 0.7459
13
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
figure();
subplot(2,1,1);loglog(w,magz);grid on
title('Magnitude Response of desired digital filter transfer function');
xlabel('Frequency (rad/s)'); ylabel('Magnitude');
subplot(2,1,2);semilogx(w,phasedegz);grid on
title('Phase Response of desired digital filter transfer function');
xlabel('Frequency (rad/s)'); ylabel('Phase (degrees)');
lines = findall(gcf,'type','line');
lines(1).Color ='blue'; lines(2).Color = 'red';
14
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
15
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
Ex4: Design and implementation of IIR low pass digital filter using Bi-linear
transformation:
Design a digital low pass Butterworth filter using impulse-invariant transformation with
pass band and stop band cut off frequencies 0.08*pi and 0.2*pi rad/sec respectively. The
pass band and stop band attenuation are -1.5 dB and -20 dB respectively.
16
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
Os
Os =
0.649839392465813
Determining the order and cut off-frequency of the Butterworth low pass filter.
1
---------------------
17
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
s^3 + 2s^2 + 2s + 1
0.02758
-------------------------------------
s^3 + 0.6043 s^2 + 0.1826 s + 0.02758
% Bilinear Transformation
[bz,az] = bilinear(b,a,fs);
bz
bz = 1×4
0.002551426100714 0.007654278302140 0.007654278302146 ⋯
az
az = 1×4
1.000000000000000 -2.402375809033949 1.970483495648343 ⋯
% Digital filter transfer function with desired cut off frequency
Hsz = tf(bz, az,1);
Hsz
Hsz =
18
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
Plotting the frequency response of desired digital Butterworth LPF using Bilinear
transformation.
figure();
subplot(2,1,1);loglog(w,magz);grid on
title('Magnitude Response of desired digital filter transfer function');
xlabel('Frequency (rad/s)'); ylabel('Magnitude');
subplot(2,1,2);semilogx(w,phasedegz);grid on
title('Phase Response of desired digital filter transfer function');
xlabel('Frequency (rad/s)'); ylabel('Phase (degrees)');
lines = findall(gcf,'type','line');
lines(1).Color ='blue'; lines(2).Color = 'red';
19
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
20
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
(a) Study and understand the basic theory required for this lab.
(b) Study and prepare the analytical solutions for given examples.
In Lab session:
(a) Run the Matlab scripts of given examples and study the results.
(b) Study the exercise questions and develop Matlab and observe the results.
(c) Note the results and store the necessary figures and data for the lab report.
21
Digital Signal Processing Lab, Dept. of ECE, KL University. Id. No: 2000040230
Exercise1: Consider the following specifications of an analog Butterworth low pass filter.
Sampling rate of 40 kHz, pass band edge frequency of 4 kHz, stop band edge frequency
of 8 kHz, Pass band ripple of 0.5 dB, and a minimum stop band attenuation of 40 dB.
(i) Find the order and cutoff frequency (ii) Determine the normalized and desired LPF.
(ii) Assume the suitable data.6
Exercise2: Consider the following specifications:
(i)
Design and implement the digital low pass filters using (a) Impulse Invariance
transformation method. (b) Bi-linear transformation method. Assume suitable data.
Exercise3: Design and develop high pass filters for the exercise questions in above.
(a) Complete the lab work in all aspects in the given specified lab time.
(b) Answer the given questions.
(c) Submit the lab report to the lab in-structure and get the signature in time.
(d) Type the complete description of commands used in the lab.
1. Vinay K Ingle and John G. Proakis, ‘Digital Signal Processing using Matlab’,
3rd edition, Cambridge University Press, New York, 2011.
2. Sanjit K. Mitra, Digital Signal Processing: A Computer based Approach,4th
edition.
22