EEE 4510 Homework: IIR Filter Design, Implementation & Analysis

Verified

Added on  2023/06/14

|16
|1796
|386
Homework Assignment
AI Summary
This document presents a solution to an electrical engineering assignment (EEE 4510) involving the design and implementation of an IIR filter using MATLAB. The solution details the selection of a high-pass elliptic filter based on specific Z number digits, converts analogue frequencies to normalized radian frequencies, and provides the MATLAB code used for filter design and analysis. The code calculates filter coefficients, poles, and zeros, and includes frequency response plots and signal filtering. Further, the document addresses questions related to transfer functions, pole-zero plots, DTFT, and DFT, contrasting their properties and providing relevant MATLAB code and graphical representations. It also demonstrates the signal spectrum analysis for various N values. The document concludes with a list of cited works.
Document Page
Surname 1
Name:
University:
Course:
Tutor:
Date:
SOLUTION:
Question 1:
a. My last two digits for my Z number are 20 therefore I am going to design high pass (3) elliptic
filter (0). The analogue frequencies in equation 1 below can be converted to normalized radian
frequencies as follows:
normalized radian frequencies= 2πf
sampling frequency
Therefore:
1000 HZ will be: 0.2π rad/sample
2000 HZ will be: 0.4π rad/sample
3000 HZ will be: 0.6π rad/sample
4000 HZ will be: 0.8π rad/sample
I have decided to place the pass and stop frequencies at 2500 Hz and 2200 Hz respectively.
b. I have used the following code to solve instruction 2 the results are as shown below:
clear all;%clearing and closing all files
clc;
close all
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Surname 2
Ws=2500/10000;Wp=2200/10000;Rp=0.5;Rs=60;%filter specifications
[N wp]=ellipord (Wp,Ws,Rp,Rs);
N %filter order
% filter coefficients and poles and zeros
[b a]=ellip (N, Rp, Rs, wp,'high');
[z p k]=ellip (N,Rp,Rs,wp);
Fvtool (b,a)
%testing the filter
fs =10000;
t=0:1/fs: 0.2;
w=2*pi*t;
x_t=cosd (w*1000) +cosd (w*2000-60) +cosd(w*3000+30)+cosd(w*4000-90);
figure
plot (t,x_t)
title('original signal')
xlabel ('time in seconds')
ylabel ('magnitude')
y_t=filter (b,a,x_t);
figure
plo t(t,y_t)
title ('filtered signal')
xlabel ('time in seconds')
ylabel ('magnitude')
[H, T]=impz (b,a);
N=8 order of the filter
Poles: p =
0.7872 + 0.1726i
0.7872 - 0.1726i
0.7716 + 0.4403i
0.7716 - 0.4403i
Document Page
Surname 3
0.7600 + 0.5773i
0.7600 - 0.5773i
0.7604 + 0.6315i
0.7604 - 0.6315i
Zeros: z =
-0.3736 + 0.9276i
-0.3736 - 0.9276i
0.4965 + 0.8680i
0.4965 - 0.8680i
0.6718 + 0.7407i
0.6718 - 0.7407i
0.7144 + 0.6997i
0.7144 - 0.6997i
-
Figure 1: Filter coefficients
Document Page
Surname 4
Figure 2: magnitude response
Figure 3: Phase response
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Surname 5
Figure 4: Pole/zero plot
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
time in seconds
-3
-2
-1
0
1
2
3
magnitude
original signal
Figure 5: Original signal
Document Page
Surname 6
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
time in seconds
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
magnitude
filtered signal
Figure 6: Filtered signal
Question 2:
a. H ( z )= 1 z2
1+ 0.9025 z2
( 1+0.9025 z2 ) Y ( z ) = ( 1z2 ) X ( z )
Taking the inverse lapse we have:
Y[n] =-0.9025y [n-2]+x[n]-x[n-2]
The order of the filter is 2 because the highest feedforward and feedback filter order is 2.
b. From the long division we have transfer function as:
H(z)=1-1.9025Z-2+1.717Z-4-1.5496Z-6+1.399Z-8-1.262Z-10
close all;
clear all;
clc;
b= [1 -1];
Document Page
Surname 7
a= [1 0.9025];
[H W]=impz (b,a);
From the code the coefficients are:
H =
1.0000
-1.9025
1.7170
-1.5496
1.3985
-1.2622
c. The poles can be obtained as follows:
H ( z )= 1 z2
1+ 0.9025 z2 = z2+1
0.9025+ z2
Poles at: Z2 +0.9025=0 Z =± j0.95
Zeroes at: Z2 1=0 Z=±1
The frequency response can be sketched as:
Figure 7: Sketch of the magnitude response
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Surname 8
Matlab code and the plot
close all;
clear all;
clc;
b= [1 0 -1];
a= [1 0 0.9025];
[H W]=impz (b,a);
Freqz (b,a)
Figure 8: Frequency response
d. The block diagram of the filter can be represented as:
Document Page
Surname 9
Figure 9: Block diagram represention of the filter
Question 3
Pole-zero plots 1 has magnitude frequency response plot A.
Pole-zero plots 2 has magnitude frequency response plot C.
Pole-zero plots 3 has magnitude frequency response plot E.
Pole-zero plots 4 has magnitude frequency response plot B.
Pole-zero plots 5 has magnitude frequency response plot A.
Pole-zero plots 6 has magnitude frequency response plot D.
The transfer function for the first three plots will be given by:
H ( Z )= Z
Z2+1.2 Z +0.85
H ( Z )= Z +1
Z0.981
H ( Z ) = Z
Z2+1
Document Page
Surname 10
The frequency response for the above will be given respectively by:
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-50
0
50
100
Phase (degrees)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-10
0
10
20
Magnitude (dB)
Figure 10: plot 1
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Surname 11
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-100
-50
0
Phase (degrees)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-50
0
50
Magnitude (dB)
Figure 11: plot 2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-100
-50
0
50
100
Phase (degrees)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-20
0
20
40
Magnitude (dB)
Figure 12: plot 3
Document Page
Surname 12
Question 4
The general representation of a DTFT is given by:
Therefore finite signal can be represented as:
X ( Ω ) =x ( 2 ) e j 2 Ω +x ( 0 ) e j 0 Ω + x ( 1 ) e j Ω +x ( 0 ) e j 0 Ω + x (3 ) e j3 Ω+ x (1 ) e j Ω +x ( 1 ) e j Ω
Its z transform will be:
X ( Z )=x ( 2 ) Z2+ x ( 0 ) Z0 + x ( 1 ) Z1 + x ( 0 ) Z0+ x (3 ) Z3 + x (1 ) Z1+x ( 1 ) Z1
clear all;%clearing and closing all files
clc;
close all
n= [32 64 128];
X= [2 0 1 0 -3 -1 1];
H=fft(X);
H';
Stem (H,'filled')
grid
ylabel('signal spectrum')
chevron_up_icon
1 out of 16
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]