ECE 4213/5213 Homework 3 Solution: Fall 2020 Dr. Havlicek
ECE 4213/5213 Homework 3 Solution: Fall 2020 Dr. Havlicek
Homework 3 Solution
Fall 2020 Dr. Havlicek
1(a). The following graphs were obtained by running Program P2 2 with the three specified
frequencies:
f = 0.05
Input Signal
1
0.5
Amplitude
−0.5
−1
0 20 40 60 80 100 120 140 160 180 200
Time index n
Output signal
1
Amplitude
0.5
0
0 20 40 60 80 100 120 140 160 180 200
Time index n
1
f = 0.10
Input Signal
1
0.5
Amplitude
0
−0.5
−1
0 20 40 60 80 100 120 140 160 180 200
Time index n
Output signal
1
0.8
Amplitude
0.6
0.4
0.2
0 20 40 60 80 100 120 140 160 180 200
Time index n
f = 0.25
Input Signal
1
0.5
Amplitude
−0.5
−1
0 20 40 60 80 100 120 140 160 180 200
Time index n
Output signal
2
1.5
Amplitude
0.5
0
0 20 40 60 80 100 120 140 160 180 200
Time index n
2
1(b). The output signals depend on the frequencies of the input signal according to:
y[n] = sin2 (ω) = sin2 (2πf ).
Mathematical Verification:
Let ω = 2πf and let the input signal be x[n] = cos(ωn). Then (2.14) on page 21 of
the course Laboratory Manual becomes
y[n] = cos2 (ωn) − cos2 (ωn) + sin2 (ω) = sin2 (ω), (6)
3
2(a). Listing of the modified program to make the input a cosine plus constant:
% Program Q2_6
% Modified version of P2_2 to make the input a cosine plus a constant.
clf;
n = 0:200;
K = 0.5;
f = 0.1;
arg = 2*pi*f*n;
x = cos(arg) + K;
% Compute the output signal
x1 = [x 0 0]; % x1[n] = x[n+1]
x2 = [0 x 0]; % x2[n] = x[n]
x3 = [0 0 x]; % x3[n] = x[n-1]
y = x2.*x2-x1.*x3;
y = y(2:202);
% Plot the input and output signals
subplot(2,1,1)
plot(n, x)
xlabel(’Time index n’);ylabel(’Amplitude’);
title(’Input Signal’)
subplot(2,1,2)
plot(n,y)
xlabel(’Time index n’);ylabel(’Amplitude’);
title(’Output signal’);
4
Graphs obtained by running the modified program:
f = 0.1, K = 0.5
Input Signal
1.5
1
Amplitude
0.5
−0.5
0 20 40 60 80 100 120 140 160 180 200
Time index n
Output signal
3
2
Amplitude
0
0 20 40 60 80 100 120 140 160 180 200
Time index n
2(b). From Eq. (3) on page 366 of the paper by Restrepo and Quiroga, we obtained
Let x[n] = cos(ω0 n) + K. Eq. (2.14) of the course Laboratory Manual says that
We have that
x2 [n] = cos2 (ω0 n) + 2K cos(ω0 n) + K 2 . (9)
Working on the second term on the right-hand side of (8), we obtain
5
and
x[n + 1] = cos[ω0 (n + 1)] + K = cos(ω0 n + ω0 ) + K,
so
Substituting this into (10) and applying the trigonometric identity cos(A+B)+cos(A−B) =
2 cos(A) cos(B) to the term in square brackets, we get
Substituting (9) and (12) into (8) then produces the final result
Equations (7) and (13) provide the answer to how the output signal y[n] depends on the
DC value K. Compared to the case where x[n] = cos(ω0 n), there is an extra term added
to y[n]. This extra term is a cosine having the same frequency as the input and having an
amplitude of 2K[1 − cos(ω0 )]. This term adds a ripple to y[n] which may be plainly seen in
the graph on the preceding page. The amplitude of the ripple is proportional to K.
6
3(a). I selected the paper:
P. Maragos, J.F. Kaiser, and T.F. Quatieri, “On separating amplitude from frequency
modulations using energy operators,” in Proc. IEEE Int’l. Conf. Acoust., Speech, Signal
Proc., San Francisco, CA, Mar. 23-26, 1992, vol. II, pp. 1-4.
% Program DESA1
% Implement the DESA-1 discrete energy separation algorithm
clear;
clf;
% Generate the input signal
n = 0:250;
A = 5.0;
f = 0.1;
w = 2*pi*f;
x = A*cos(w*n);
% TK operator on y[n]
ynp1 = [y 0 0]; % y[n+1]
yn = [0 y 0]; % y[n]
ynm1 = [0 0 y]; % y[n-1]
Psi_y = yn.*yn-ynm1.*ynp1;
% TK operator on z[n]
znp1 = [z 0 0]; % z[n+1]
zn = [0 z 0]; % z[n]
znm1 = [0 0 z]; % z[n-1]
Psi_z = zn.*zn-znm1.*znp1;
% TK operator on x[n]
x2np1 = [x2 0 0]; % x2[n+1]
7
x2n = [0 x2 0]; % x2[n]
x2nm1 = [0 0 x2]; % x2[n-1]
Psi_x2 = x2n.*x2n-x2nm1.*x2np1;
figure(2);
plot(n,IAhat);
xlabel(’Time index n’);ylabel(’IA a[n]’);
title(’Instantaneous Amplitude (IA)’);
figure(3);
plot(n,IFhat);
xlabel(’Time index n’);ylabel(’IF \omega[n] / (2\pi)’);
title(’Instantaneous Frequency (IF)’);
8
Plots obtained by running the program with the input signal x[n] = 5 cos[2π(0.1)n]:
Input Signal
6
Amplitude
0
−2
−4
−6
0 50 100 150 200 250
Time index n
Instantaneous Amplitude (IA)
6.5
5.5
5
a[n]
IA
4.5
3.5
3
0 50 100 150 200 250
Time index n
Instantaneous Frequency (IF)
0.17
0.16
0.15
0.14
ω[n] / (2π)
0.13
IF
0.12
0.11
0.1
0.09
0 50 100 150 200 250
Time index n
9
3(c). Plots obtained by running the program on an AM-FM chirp signal:
Input Signal
6
Amplitude
0
−2
−4
−6
0 50 100 150 200 250
Time index n
Instantaneous Amplitude (IA)
6
4
a[n]
3
IA
0
0 50 100 150 200 250
Time index n
Instantaneous Frequency (IF)
0.5
0.45
0.4
0.35
ω[n] / (2π)
0.3
0.25
IF
0.2
0.15
0.1
0.05
0
0 50 100 150 200 250
Time index n
10