Copy from figure windows and paste... The plot of the gain response of the stable transfer function HBPz obtained using< Insert MATLAB figures here.. Copy from figure windows and paste..
Trang 1LINEAR, TIMEINVARIANT DISCRETETIME SYSTEMS:
FREQUENCYDOMAIN REPRESENTATIONS
4.1 TRANSFER FUNCTION AND FREQUENCY RESPONSE
Project 4.1 Transfer Function Analysis
Answers:
Q4.1
The modified Program P3_1 to compute and plot the magnitude and phase spectra of a
% Program P3_1
% Evaluation of the DTFT
clf;
% Compute the frequency samples
of the DTFT
w = 0:8*pi/511:2*pi;
m = 5;
num =ones(1,m)/m;
h = freqz(num, 1, w);
% Plot the DTFT
subplot(2,1,1)
plot(w/pi,abs(h));grid title('Magnitude Spectrum | H(e^{j\omega})|')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2) plot(w/pi,angle(h));grid title('Phase Spectrum arg[H(e^{j\omega})]') xlabel('\omega /\pi');
ylabel('Phase in radians');
0
0.5
j )|
/
4
2
0
2
j )]
/
The types of symmetries exhibited by the magnitude and phase spectra are due to
1
Trang 2The results of Question Q2.1 can now be explained as follo -
0
0.5
j )|
2
1
0
1
j )]
0
0.5
j )|
/
4
2
0
2
j )]
/
nhau
Trang 3I shall choose the filter of Question Q4.2 for the following reason Vì đáp ng pha ứ
t t h n ố ơ
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
2
4
6
8 Magnitude Spectrum |H(e
j )|
/
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1
0.5
0
0.5
1 Phase Spectrum arg[H(e
j )]
/
Questions 4.2 and 4.3 obtained using the program developed in Question Q3.50
0 10 20 30 40 50 60 70 80 90 100
1.2
1
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8 impule
/
3
Trang 40 10 20 30 40 50 60 70 80 90 100
4
3
2
1
0
1
2
3
4
5
/
2.5 2 1.5 1 0.5 0 0.5 1 1.5 2 2.5
2
1.5
1
0.5
0
0.5
1
1.5
2
Real Part
2.5 2 1.5 1 0.5 0 0.5 1 1.5 2 2.5
2
1.5
1
0.5
0
0.5
1
1.5
2
Real Part
Trang 54.2 TYPES OF TRANSFER FUNCTIONS
Project 4.2 Filters
% Program P4_1
% Impulse Response of Truncated Ideal Lowpass Filter
clf;
fc = 0.25;
n = [-6.5:1:6.5];
y = 2*fc*sinc(2*fc*n);k = n+6.5;
stem(k,y);title('N = 13');axis([0 13 -0.2 0.6]);
xlabel('Time index n');ylabel('Amplitude');grid;
Answers:
0.2
0.1
0
0.1
0.2
0.3
0.4
0.5
Time index n
[-6.5:1:6.5];
response of the FIR lowpass filter of Project 4.2 with a length of 20 and a cutoff
% Program P4_1
% Impulse Response of Truncated Ideal Lowpass Filter
clf;
fc = 0.45;
n = [-10:1:10];
y = 2*fc*sinc(2*fc*n);k = n+10;
stem(k,y);title('N = 20');axis([0 20 -0.2
1]);
xlabel('Time index
n');ylabel('Amplitude');grid;
5
0.2 0 0.2 0.4 0.6 0.8
N = 20
Trang 6The plot generated by running the modified program is given below:
response of the FIR lowpass filter of Project 4.2 with a length of 15 and a cutoff
% Program P4_1
% Impulse Response of Truncated Ideal
Lowpass Filter
clf;
fc = 0.65;
n = [-7.5:1:7.5];
y = 2*fc*sinc(2*fc*n);k = n+7.5;
stem(k,y);title('N = 15');axis([0 20
-0.2 0.6]);
xlabel('Time index
n');ylabel('Amplitude');grid;
The plot generated by running the
Q4.10 The MATLAB program to compute and plot the amplitude response of the FIR
% Program P4_1
% Impulse Response of Truncated Ideal
Lowpass Filter
clf;
fc = 0.25;
n = [-6.5:1:6.5];
y = 2*fc*sinc(2*fc*n);k = n+6.5;
plot(k,y);title('N = 13');axis([0 13 -0.2
0.6]);
xlabel('Time index
n');ylabel('Amplitude');grid;
Plots of the amplitude response of the
N = 15
0.2
0.1 0 0.1 0.2 0.3 0.4 0.5
Time index n
0.2
0.1 0 0.1 0.2 0.3 0.4 0.5
Time index n
Trang 70 2 4 6 8 10 12
0.2
0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
Time index n
N= 19
0.2
0.1
0
0.1
0.2
0.3
0.4
0.5
0.6 N = 19
Time index n
% Program P4_2
% Gain Response of a Moving
Average Lowpass Filter
clf;
M = 2;
num = ones(1,M)/M;
[g,w] = gain(num,1);
plot(w/pi,g);grid axis([0 1 -50 0.5]) xlabel('\omega /\pi');ylabel('Gain in dB');
title(['M = ', num2str(M)])
Answers:
Q4.11 A plot of the gain response of a length-2 moving average filter obtained using
7
Trang 80 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
50
45
40
35
30
25
20
15
10
5
0
/
Q4.12 The required modifications to Program P4_2 to compute and plot the gain response
% Program P4_2
% Gain Response of a Moving Average Lowpass Filter
clf;
M = 2;
num =[1 1]/M;
[g,w] = gain(num,1);
plot(w/pi,g);grid
axis([0 1 -50 0.5])
xlabel('\omega /\pi');ylabel('Gain in dB');
title(['M = ', num2str(M)])
The plot of the gain response for a cascade of 3 sections obtained using the
50
45
40
35
30
25
20
15
10
5
0
/
M = 3
Q4.13 The required modifications to Program P4_2 to compute and plot the gain response
% Program P4_2
% Gain Response of a Moving Average Lowpass Filter
Trang 9M = 5;
num =[1 -1 1 -1 1]/M;
[g,w] = gain(num,1);
plot(w/pi,g);grid
axis([0 1 -50 0.5])
xlabel('\omega /\pi');ylabel('Gain in dB');
title(['M = ', num2str(M)])
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
50
45
40
35
30
25
20
15
10
5
0
M = 5
Q4.14 From Eq (4.16) for a 3-dB cutoff frequency c at 0.45 we obtain = 0.0787
function of the first-order IIR lowpass and highpass filters, respectively, given by
HLP(z) =
HHP(z) =
9
Trang 100 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
50
45
40
35
30
25
20
15
10
5 0
/
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
50
45
40
35
30
25
20
15
10
5
0
/
A plot of the magnitude response of
From this plot we observe that the two filters
A plot of the sum of the
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
Q4.15 From Eq (4.24), we get substituting K = 10, B = 1.86
of 10 IIR lowpass filters as
1 z1
1 – z1
10
(7.85+7.85z1)/(2+13.7z1)
0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21
0.6
0.5
0.4
0.3
0.2
0.1 0 0.1
/
M = 5
Trang 11Using this value of in Eq (4.15) we arrive at the transfer function of a first-order IIR lowpass filter
HLP,1(z) 1 –
1 z1
1 – z1 (7.7+7.7z1)/(2+13.4z1)
< Insert
Q4.16 Substituting o = 0.61 in Eq (4.19) we get cos(0.61)
transfer function of the IIR bandpass transfer function
HBP,1(z) =
transfer function of the IIR bandpass transfer function
HBP,2(z) =
11
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
50
45
40
35
30
25
20
15
10
5 0
/
M = 21
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
50
45
40
35
30
25
20
15
10
5 0
/
HHP
Trang 12The plot of the gain response of the stable transfer function HBP(z) obtained using
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
of a stable IIR bandstop filter as
MATLAB is shown below:
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
From these plots we observe that the designed filters do/do not meet the
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
Q4.17 The transfer function of a comb filter derived from the prototype FIR lowpass filter
of Eq (4.38) is given by
G(z) = H0(zL) = Plots of the magnitude response of the above comb filter for the following values of
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
Trang 13From these plots we observe that the comb filter has _ notches at k = _
Q4.18 The transfer function of a comb filter derived from the prototype FIR highpass filter
G(z) = H1(zL) = Plots of the magnitude response of the above comb filter for the following values of
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
_
Q4.19 A copy of Program P4_3 is given below:
% Program P4_3
% Zero Locations of Linear Phase FIR Filters
clf;
b = [1 -8.5 30.5 -63];
num1 = [b 81 fliplr(b)];
num2 = [b 81 81 fliplr(b)];
num3 = [b 0 -fliplr(b)];
num4 = [b 81 -81 -fliplr(b)];
n1 = 0:length(num1)-1;
n2 = 0:length(num2)-1;
subplot(2,2,1); stem(n1,num1);
xlabel('Time index n');ylabel('Amplitude'); grid;
title('Type 1 FIR Filter');
subplot(2,2,2); stem(n2,num2);
xlabel('Time index n');ylabel('Amplitude'); grid;
title('Type 2 FIR Filter');
subplot(2,2,3); stem(n1,num3);
xlabel('Time index n');ylabel('Amplitude'); grid;
title('Type 3 FIR Filter');
subplot(2,2,4); stem(n2,num4);
xlabel('Time index n');ylabel('Amplitude'); grid;
title('Type 4 FIR Filter');
pause
subplot(2,2,1); zplane(num1,1);
title('Type 1 FIR Filter');
subplot(2,2,2); zplane(num2,1);
title('Type 2 FIR Filter');
subplot(2,2,3); zplane(num3,1);
title('Type 3 FIR Filter');
subplot(2,2,4); zplane(num4,1);
title('Type 4 FIR Filter');
13
0 2 4 6 8
100
50 0 50 100
Time index n
Type 1 FIR Filter
100
50 0 50 100
Time index n
Type 2 FIR Filter
0 2 4 6 8
100
50 0 50 100
Time index n
Type 3 FIR Filter
100
50 0 50 100
Time index n
Type 4 FIR Filter
Trang 14disp('Zeros of Type 1 FIR Filter are');
disp(roots(num1));
disp('Zeros of Type 2 FIR Filter are');
disp(roots(num2));
disp('Zeros of Type 3 FIR Filter are');
disp(roots(num3));
disp('Zeros of Type 4 FIR Filter are');
disp(roots(num4));
- Các tín hiệu kế tiếp nhau cho ta thấy các giá trị M của tín hiệu là khác nhau : tín
hiệu 1 và 3 thì giá trị M chẵn và tín hiệu 2 và 4 thì giá trị M lẽ.
- Tín hiệu 1 có M=8 và a = 1.979
- Tín hiệu 2 có M= 9 và a = 1
- Tín hiệu 3 có M= 8 và a = 0
- Tín hiệu 4 có M = 9 và a = 1
The plots of the impulse responses of the four FIR filters generated by running
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
Trang 15Filter #1 has zeros at z =
Plots of the phase response of each of these filters obtained using MATLAB are
< Insert MATLAB figure(s) here Copy from figure window(s) and paste >
Q4.20 The plots of the impulse responses of the four FIR filters generated by running
% Program P4_3
% Zero Locations of Linear Phase FIR Filters
clf;
b = [1 -8.5 30.5 -63];
num1 = [b 81 fliplr(b)];
num2 = [b 81 81 fliplr(b)];
num3 = [b 0 -fliplr(b)];
num4 = [b 81 -81 -fliplr(b)];
n1 = 0:length(num1)-1;
n2 = 0:length(num2)-1;
subplot(2,2,1); stem(n1,num1);
xlabel('Time index n');ylabel('Amplitude'); grid;
title('Type 1 FIR Filter');
subplot(2,2,2); stem(n2,num2);
xlabel('Time index n');ylabel('Amplitude'); grid;
title('Type 2 FIR Filter');
subplot(2,2,3); stem(n1,num3);
xlabel('Time index
n');ylabel('Amplitude'); grid;
title('Type 3 FIR Filter');
subplot(2,2,4); stem(n2,num4);
xlabel('Time index
n');ylabel('Amplitude'); grid;
title('Type 4 FIR Filter');
pause
subplot(2,2,1); zplane(num1,1);
title('Type 1 FIR Filter');
15
0 2 4 6 8
100
50 0 50 100
Time index n
Type 1 FIR Filter
100
50 0 50 100
Time index n
Type 2 FIR Filter
0 2 4 6 8
100
50 0 50 100
Time index n
Type 3 FIR Filter
100
50 0 50 100
Time index n
Type 4 FIR Filter
Trang 16subplot(2,2,2); zplane(num2,1);
title('Type 2 FIR Filter');
subplot(2,2,3); zplane(num3,1);
title('Type 3 FIR Filter');
subplot(2,2,4); zplane(num4,1);
title('Type 4 FIR Filter');
disp('Zeros of Type 1 FIR Filter are');
disp(roots(num1));
disp('Zeros of Type 2 FIR Filter are');
disp(roots(num2));
disp('Zeros of Type 3 FIR Filter are');
disp(roots(num3));
disp('Zeros of Type 4 FIR Filter are');
disp(roots(num4));
- Các tín hiệu kế tiếp nhau cho ta thấy các giá trị M của tín hiệu là khác nhau : tín hiệu 1 và 3 thì giá trị M chẵn và tín hiệu 2 và 4 thì giá trị M lẽ.
- Tín hiệu 1 có M=8 và a = 1.979
- Tín hiệu 2 có M= 9 và a = 1
- Tín hiệu 3 có M= 8 và a = 0
- Tín hiệu 4 có M = 9 và a = 1