Upload
94747
View
215
Download
0
Embed Size (px)
Citation preview
8/2/2019 [EE3101] Laboratory 2 Report
1/14
EE3101 Digital Signal Processing Laboratory ReportAng Zhi Ping U066463H
EE3101 Laboratory 2: IIR Digital Filter Design
Name: Ang Zhi PingMatric No.: U066463H
Date: 12th November 2008
Q1.
432 6130.24140.36130.211)(
sssssHa
++++=
The commands executed are:
>> analog_pole = roots([1 2.6130 3.4140 2.6130 1])
analog_pole =
-0.3826 + 0.9239i
-0.3826 - 0.9239i
-0.9239 + 0.3827i
-0.9239 - 0.3827i
Since the real part of all poles of Ha(s) is negative (-0.3826 and -0.9239), all poles of the
filter lies in the open left half plane. This implies that the analog filter is stable.
Q2.
The commands executed are:
>> [H,w] = freqs([1],[1 2.6130 3.4140 2.6130 1]);
>> plot(w,20*log10(abs(H)),'k'),title('Magnitude Response of
H_a(s)'),xlabel('Frequency (rad s^-^1)'),ylabel('Magnitude
(dB)'),xlim([0 10]),ylim([-80 10]),grid on,hold;>> plot([0:10],-3*ones(length([0:10])),'--k');
>> plot([1 1],[-80,10],'--k');
Refer to Graph A.
The filter is a low pass filter with 3 dB cutoff frequency at 1 rad/s It has unity DC gain
8/2/2019 [EE3101] Laboratory 2 Report
2/14
EE3101 Digital Signal Processing Laboratory ReportAng Zhi Ping U066463H
% repeated convolutionsb0 = [1]; % 1
b1 = conv(b0,a); % sb2 = conv(b1,a); % s^2b3 = conv(b2,a); % s^3b4 = conv(b3,a); % s^4b0(length(b4)) = 0; % Pad coefficients to fit the longest vector b4b1(length(b4)) = 0;b2(length(b4)) = 0;b3(length(b4)) = 0;B = [1];A = 1*b0 + 2.6130*b1 + 3.4140*b2 + 2.6130*b3 + 1*b4;[H,w] = freqz(B,A,8192);plot(w,20*log10(abs(H))),title('Frequency Response for IIR Filter Using
Derivative Approximation Method for T=0.05'),xlim([0
pi]),xlabel('Frequency (rad/sample)'),ylabel('Magnitude (dB)'),grid on;
Refer to Graph B.
Q4.
The script which is executed is:
% EE3101 Laboratory 2 Question 4% Ang Zhi Ping% U066463H
% The MATLAB function impinvar() is used which uses the impulse% invariance method to perform analog to digital filter conversionanalog_b = [1];analog_a = [1 2.6130 3.4140 2.6130 1];
% T=0.05[bz1,az1] = impinvar(analog_b,analog_a,1/0.05);
% T=0.25
[bz2,az2] = impinvar(analog_b,analog_a,1/0.25);
% T=0.45[bz3,az3] = impinvar(analog_b,analog_a,1/0.45);
% Computing digital frequency response[h1 w1] = freqz(bz1 az1 8192);
8/2/2019 [EE3101] Laboratory 2 Report
3/14
EE3101 Digital Signal Processing Laboratory ReportAng Zhi Ping U066463H
(rad/sample)'),ylabel('Magnitude (dB)'),xlim([0 pi]),ylim([-80
10]),grid;
Refer to Graph C.
Q5.
The script which is executed is:
% EE3101 Laboratory 2 Question 5% Ang Zhi Ping% U066463H
% The MATLAB function bilinear() is used which uses the bilinear% transformation to perform analog to digital filter conversionanalog_b = [1];analog_a = [1 2.6130 3.4140 2.6130 1];
% T=0.05[bz1,az1] = bilinear(analog_b,analog_a,1/0.05);
% T=0.25[bz2,az2] = bilinear(analog_b,analog_a,1/0.25);
% T=0.45[bz3,az3] = bilinear(analog_b,analog_a,1/0.45);
% Computing digital frequency response[h1,w1] = freqz(bz1,az1,8192);[h2,w2] = freqz(bz2,az2,8192);[h3,w3] = freqz(bz3,az3,8192);
% Plotting all magnitude responses on the same graphsubplot(3,1,1),plot(w1,20*log10(abs(h1))),title( 'Magnitude Response of
H(z) Using Bilinear Transformation Method (T=0.05)'),xlabel('Frequency
(rad/sample)'),ylabel('Magnitude (dB)'),xlim([0 pi]),ylim([-30010]),grid;subplot(3,1,2),plot(w2,20*log10(abs(h2))),title( 'Magnitude Response of
H(z) Using Bilinear Transformation Method (T=0.25)'),xlabel('Frequency
(rad/sample)'),ylabel('Magnitude (dB)'),xlim([0 pi]),ylim([-300
10]),grid;subplot(3,1,3),plot(w3,20*log10(abs(h3))),title( 'Magnitude Response of
( ) i ili f i h d ( 0 45)') l b l('
8/2/2019 [EE3101] Laboratory 2 Report
4/14
EE3101 Digital Signal Processing Laboratory ReportAng Zhi Ping U066463H
Zooming in to see the 3 dB cutoff frequency, the T = 0.05 filter has a 3 dB cutoff at
exactly 0.05 rad (given = 1 rad/s). For T = 0.25, the 3 dB cutoff has shifted leftwards to
0.248 rad instead of 0.25 rad, and for T = 0.45, the 3 dB cutoff has shifted further to 0.442rad instead of 0.45 rad. This is a result of the non-linear mapping of the analog frequency
axis to the digital frequency unit circle. As the mapping function from analog to digital
frequency is given by the arctangent function, the mapping is approximately linear for
small values ofT but large analog frequencies will be mapped to smaller-than-expected
values of digital frequencies if the linear property is used as an estimate.
Refer to Graph E for the nonlinear frequency mapping observation.
Q6.
The standard form of third order Butterworth filters is:
)1)(1(
1
)( 2ssssH
a+++
=
Given 1,c = 0.1 rad/s and 2,c = 0.2 rad/s, the required transformed Butterworth filters are:
)2551)(51(
1)(
)100101)(101(
1)(
2,2
2,1
ssssH
ssssH
a
a
+++=
+++=
The following script is executed:
% EE3101 Laboratory 2 Question 6% Ang Zhi Ping% U066463H
[h1,w1]=freqs([1],conv([100 10 1],[10 1]));[h2,w2]=freqs([1],conv([25 5 1],[5 1]));
% Plotting magnitude response of Butterworth filtersubplot(2,1,1),plot(w1,20*log10(abs(h1))),title( 'Magnitude Response of
Butterworth Filter (N=3,\Omega_c=0.1 rad s^-^1)'),xlabel('Frequency (rad
8/2/2019 [EE3101] Laboratory 2 Report
5/14
EE3101 Digital Signal Processing Laboratory ReportAng Zhi Ping U066463H
Q7.
For frequency transformation method, the transformation equation is:
=
+
=
+
+
+
++
+
=
2tan
2cot,
2cos
2cos
,
1
1
1
21
1
2
1
1
12
12
12
21
21
1
k
Zk
kZ
k
k
ZZk
k
k
k
z
The following script is executed for both matched-Z and frequency transformation
methods:
% EE3101 Laboratory 2 Question 7% Ang Zhi Ping% U066463H
analog_b1 = [1];
analog_a1 = conv([100 10 1],[10 1]);
analog_b2 = [1];analog_a2 = conv([25 5 1],[5 1]);
% The MATLAB function c2d() is used which converts an analog filter to% discrete filter using the 'matched' option which does the matched-Z% transformationsys1 = tf(analog_b1,analog_a1);sys2 = tf(analog_b2,analog_a2);
% Perform matched-Z transformation using T=1sysd1 = c2d(sys1,1,'matched');sysd2 = c2d(sys2,1,'matched');
% Extracting digital coefficientsnum1 = get(sysd1,'num');den1 = get(sysd1,'den');num2 = get(sysd2,'num');den2 = get(sysd2,'den');
b1 = num1{1};a1 = den1{1};b2 = num2{1};2 d 2{1}
8/2/2019 [EE3101] Laboratory 2 Report
6/14
EE3101 Digital Signal Processing Laboratory ReportAng Zhi Ping U066463H
% The MATLAB function iirlp2bp() is used to perform lowpass to
bandpass% frequency transformation[b3,a3] = iirlp2bp(b1,a1,0.1/pi,[0.1 0.2]);[b4,a4] = iirlp2bp(b2,a2,0.2/pi,[0.1 0.2]);
% Calculating frequency response of frequency transformed bandpass% filters[h3,w3] = freqz(b3,a3,8192);[h4,w4] = freqz(b4,a4,8192);
% Plotting magnitude response of frequency transformed bandpass
filtersfigure(2),subplot(2,1,1),plot(w3,20*log10(abs(h3))),title( 'Magnitude
Response of Frequency Transformed Butterworth Filter (N=3,\Omega_c=0.1
rad s^-^1,\phi_1=0.1\pi rad,\phi_2=0.2\pi rad)'),xlabel('Frequency
(rad/sample)'),ylabel('Magnitude (dB)'),xlim([0 pi]),ylim([-200
10]),grid;subplot(2,1,2),plot(w4,20*log10(abs(h4))),title( 'Magnitude Response of
Frequency Transformed Butterworth Filter (N=3,\Omega_c=0.2 rad s^-^1,\phi_1=0.1\pi rad,\phi_2=0.2\pi rad)'),xlabel('Frequency
(rad/sample)'),ylabel('Magnitude (dB)'),xlim([0 pi]),ylim([-200
10]),grid;
Refer to Graph G (matched-Z transformation) and Graph H (frequency transformation).
8/2/2019 [EE3101] Laboratory 2 Report
7/14
0 1 2 3 4 5 6 7 8 9 10-80
-70
-60
-50
-40
-30
-20
-10
0
10
Magnitude Response of Ha(s)
Frequency (rad s-1
)
Magnitude(dB)
7
Graph A
8/2/2019 [EE3101] Laboratory 2 Report
8/14
0 0.5 1 1.5 2 2.5 3-150
-100
-50
0Frequency Response for IIR Filter Using Derivative Approximation Method for T=0.05
Frequency (rad/sample)
Magnitude(dB)
0 0.5 1 1.5 2 2.5 3-80
-60
-40
-20
0Frequency Response for IIR Filter Using Derivative Approximation Method for T=0.25
Frequency (rad/sample)
Magnitude(dB)
0 0.5 1 1.5 2 2.5 3
-60
-40
-20
0Frequency Response for IIR Filter Using Derivative Approximation Method for T=0.45
Frequency (rad/sample)
Magnitude(dB)
8
Graph B
8/2/2019 [EE3101] Laboratory 2 Report
9/14
0 0.5 1 1.5 2 2.5 3
-100
-50
0
Magnitude Response of H(z) Using Impulse Invariance Method (T=0.05)
Frequency (rad/sample)
Magnitude(dB)
0 0.5 1 1.5 2 2.5 3-100
-80
-60
-40
-20
0
Magnitude Response of H(z) Using Impulse Invariance Method (T=0.25)
Frequency (rad/sample)
M
agnitude(dB)
0 0.5 1 1.5 2 2.5 3
-80
-60
-40
-20
0
Magnitude Response of H(z) Using Impulse Invariance Method (T=0.45)
Frequency (rad/sample)
Magnitude(dB)
9
Graph C
8/2/2019 [EE3101] Laboratory 2 Report
10/14
0 0.5 1 1.5 2 2.5 3-300
-200
-100
0
Magnitude Response of H(z) Using Bilinear Transformation Method (T=0.05)
Frequency (rad/sample)
Magnitude(dB)
0 0.5 1 1.5 2 2.5 3-300
-200
-100
0
Magnitude Response of H(z) Using Bilinear Transformation Method (T=0.25)
Frequency (rad/sample)
M
agnitude(dB)
0 0.5 1 1.5 2 2.5 3
-300
-200
-100
0
Magnitude Response of H(z) Using Bilinear Transformation Method (T=0.45)
Frequency (rad/sample)
Magnitude(dB)
10
Graph D
8/2/2019 [EE3101] Laboratory 2 Report
11/14
0.04 0.045 0.05 0.055 0.06
-4
-3.5
-3
-2.5
-2
Magnitude Response of H(z) Using Bilinear Transformation Method (T=0.05)
Frequency (rad/sample)
Magnitude
(dB)
0.24 0.245 0.25 0.255 0.26
-4
-3.5
-3
-2.5
-2
Magnitude Response of H(z) Using Bilinear Transformation Method (T=0.25)
Frequency (rad/sample)
M
agnitude(dB)
0.44 0.445 0.45 0.455 0.46
-4.5
-4
-3.5
-3
-2.5
Magnitude Response of H(z) Using Bilinear Transformation Method (T=0.45)
Frequency (rad/sample)
Magnitude(dB)
11
Graph E
8/2/2019 [EE3101] Laboratory 2 Report
12/14
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-70
-60
-50
-40
-30
-20
-10
0
10
Magnitude Response of Butterworth Filter (N=3,c=0.1 rad s
-1)
Frequency (rad s-1
)
Magnitude(dB)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-70
-60
-50
-40
-30
-20
-10
0
10
Magnitude Response of Butterworth Filter (N=3,c
=0.2 rad s-1
)
Frequency (rad s-1
)
Magnitude(dB)
12
Graph F
8/2/2019 [EE3101] Laboratory 2 Report
13/14
0 0.5 1 1.5 2 2.5 3-200
-150
-100
-50
0
Magnitude Response of Matched-Z Transformed Butterworth Filter (N=3,c=0.1 rad s
-1)
Frequency (rad/sample)
Magnitude(dB)
0 0.5 1 1.5 2 2.5 3
-200
-150
-100
-50
0
Magnitude Response of Matched-Z Transformed Butterworth Filter (N=3,c
=0.2 rad s-1
)
Frequency (rad/sample)
Magnitu
de(dB)
13
Graph G
8/2/2019 [EE3101] Laboratory 2 Report
14/14
0 0.5 1 1.5 2 2.5 3-200
-150
-100
-50
0
Magnitude Response of Frequency Transformed Butterworth Filter (N=3,c=0.1 rad s
-1,
1=0.1 rad,
2=0.2 rad)
Frequency (rad/sample)
Magnitude(dB)
0 0.5 1 1.5 2 2.5 3
-200
-150
-100
-50
0
Magnitude Response of Frequency Transformed Butterworth Filter (N=3,c
=0.2 rad s-1
,1
=0.1 rad,2
=0.2 rad)
Frequency (rad/sample)
Magnitu
de(dB)
14
Graph H