Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

DSP1 – Practice Homework with Solutions

Exercise 1. Review of complex numbers.


1
P∞
(a) Let s [n] =+ j 31n . Compute n=1 s [n].
2n
€ Šn
j
(b) Do the same with s [n] = 3 .

(c) Characterize the set of complex numbers satisfying z ∗ = z −1 .

(d) Find 3 distinct complex numbers {z 0 , z 1 , z 2 } for which z i3 = 1.


Q∞ n
(e) Compute the infinite product n=1 e j π/2

Solution 1.
(a) A classic result for the partial sum of a geometric series states that:
N
¨ N +1
1−z
X
k 1−z for z 6= 1
z =
i =0
N + 1 for z = 1.

For a simple proof, we can start from the following equations:

s = 1+ z + z2 + ...+ zN ,
−z s = −z − z 2 − . . . − z N − z N +1 .

which, added together, yield

1 − z N +1
(1 − z )s = 1 − z N +1 ⇒ s = .
1−z
From this we can easily derive
N2 2 −N1
NX
X z N1 − z N2+1
z k = z N1 zk = .
k =N1 k =0
1−z

We can now write


N
X N
X N
X
s [n] = 2−n + j 3−n
n=1 n=1 n=1
1 1 − 2−N 1 1 − 3−N 1
= · +j · = (1 − 2−N ) + j (1 − 3−N ) .
2 1−2 −1 3 1−3 −1 2
Since

lim 2−N = lim 3−N = 0 .


N →∞ N →∞

we have

X 1
s [n] = 1 + j.
n=1
2

1
(b) We have

N
X j 1 − ( j /3)N
s [k ] = · .
k =1
3 1 − j /3

j 1
Since | 3 | = 3 < 1, limN →∞ ( j /3)N = 0. Therefore


X j j (3 + j ) 1 3
s [k ] = = =− + j · .
k =1
3− j 10 10 10

(c) If z ∗ = z −1 then

z z ∗ = 1, ∀ z 6= 0.

Since z z ∗ = |z |2 the condition is equivalent to |z |2 = 1; this is valid for all complex number that lie on
the unit circle in the complex plane.
2k π 2k π
(d) Since e j 2k π = 1, for all k ∈ Z, z k = e j 3 will satisfy z k3 = 1. The sequence e j 3 is periodic with period
3, so there are only three distinct values as k takes on all possible values and these are:
2π 4π
z 0 = 1, z1 = e j 3 and z2 = e j 3 .

(e) We have

N
1 1−2−N
Y π
PN −n
e j 2n = e j π n=1 2 = e jπ2· 1−1/2 .
n=1

Since limN →∞ 2−N = 0,



Y π
e j 2n = e j π = −1.
n=1

Exercise 2. Sampling music


A music song recorded in a studio is stored as a digital sequence on a CD. The analog signal representing the
music is 2 minutes long and is sampled at a frequency f s = 44100 s −1 . How many samples should be stored
on the CD?

Solution 2.
To compute the number of samples N , we need to multiply the length in seconds of the signal by the sampling
frequency, i.e., the number of samples per second:

N = 44100 × 2 × 60 = 5, 292, 000

This assumes that the audio is mono; for stereo data, there are two independent channels so the number of
samples is double.

Exercise 3. Moving average


Consider the following signal,

x [n] = δ[n] + 2δ[n − 1] + 3δ[n − 2]. (1)


x [n]+x [n−1]
Compute its moving average y [n] = 2 , where we call x [n] the input and y [n] the output.

2
Solution 3.
We compute y [n] by substituting the expression for x [n] into y [n] = (x [n] + x [n − 1])/2:
δ[n] + 2δ[n − 1] + 3δ[n − 2] + δ[n − 1] + 2δ[n − 2] + 3δ[n − 3]
y [n] =
2
By collecting the delta signals that have the same delay we finally obtain:

y [n] = 0.5δ[n] + 1.5δ[n − 1] + 2.5δ[n − 2] + 1.5δ[n − 3].

Exercise 4. SP with Lego


Given the following filter:
a b
b b
x [n] + + y [n]

z −1 −1

c
b
+ z −3

z −1

What is the input-output relationship?

Solution 4.
To determine the input-output relationship of a complex circuit, it is a good strategy to first look at the inter-
mediate signals that appear at key nodes in the graph. Once the expressions for these signals are computed,
they can be combined to produce the global output of the circuit.
In the graph below, call p [n], q [n], r [n] the internal signals in the circuit at the shown locations:

a p [n] b
b b
x [n] + + y [n]

z −1 −1

c q [n]
b
+ z −3
r [n]

z −1

Simply by inspection, we can remark the following facts:

3
(a) p [n] = a x [n] + x [n − 1]

(b) q [n] = c x [n] + x [n − 1]

(c) r [n] = q [n − 3]

(d) y [n] = b p [n] − r [n]

so that in the end

y [n] = a b x [n] + b x [n − 1] − c x [n − 3] − x [n − 4]

Exercise 5. Bases
Let {x(k ) }k =0,...,N −1 be a basis for a subspace S . Prove that any vector z ∈ S is uniquely represented in this basis.
Hint: remember that the vectors in a basis are linearly independent and use this to prove the thesis by contra-
diction.

Solution 5.
Suppose by contradiction that the vector z ∈ S admits two distinct representations in the basis {x(k ) }k =0,...,N −1 .
In other words, suppose that there exist two set of scalars α0 , . . ., αN −1 and β0 , . . ., βN −1 , with αi 6= βi for all i ,
such that
N
X −1
z= αk x(k )
k =0

and
N
X −1
z= βk x(k ) .
k =0

In this case we can write


N
X −1 N
X −1
αk x(k ) = βk x(k )
k =0 k =0

or, equivalently,
N
X −1
(αk − βk )x(k ) = 0.
k =0

The above expression is a linear combination of basis vectors that is equal to zero. Because of the linear
independence of a set of basis vector, the only set of coefficients that satisfies the above equation is a set of
null coefficients so that it must be αi 6= βi for all i , in contradiction with the hypothesis.

Exercise 6. Vector Spaces.


Consider the four diagonals of a three-dimensional unit cube as vectors in R3 . Are they mutually orthogonal?

Solution 6.
The eight vertexes of the unit cube can be represented by the following four vectors:

v1 = [0, 0, 0], v2 = [1, 0, 0], v3 = [0, 1, 0], v4 = [1, 1, 0],


v5 = [0, 0, 1], v6 = [1, 0, 1], v7 = [0, 1, 1], v8 = [1, 1, 1].

4
and the four associated diagonals are therefore:

d1 = v8 − v1 = [1, 1, 1].
d2 = v7 − v2 = [−1, 1, 1].
d3 = v6 − v3 = [1, −1, 1].
d4 = v5 − v4

T are orthogonal if their inner product is zero but it is easy to verify that 〈di , d j 〉 =
6 0 for all i , j .

Exercise 7. DFT Formula.


Derive a simple expression for the DFT of the time-reversed signal

xr = [x [N − 1] x [N − 2] . . . x [1] x [0]]T
−(N −k )
in terms of the DFT X of the signal x. Hint: you may find it useful to remark that WNk = WN .

Solution 7.
Recall the DFT (analysis) formula
N
X −1
X [k ] = x [n]WNnk .
n=0

The DFT of the time-reversed signal can be written as


N
X −1 N
X −1
X r [k ] = x r [n]WNnk = x [N − 1 − n]WNnk
n=0 n=0

−(N −n)
By replacing WNn with WN , we get

N
X −1 N
X −1
−(N −n)k −(n+1)k
X r [k ] = x [N − 1 − n]WN = x [n]WN
n=0 n=0
N
X −1 N
X −1
n(N −k )
= WN−k x [n]WN−nk = WN−k x [n]WN
n=0 n=0
−k
= WN X [N − k ].

Exercise 8. DFT Manipulation.


Consider a length-N signal x = [x [0] x [1] ... x [N − 1]]T and the corresponding vector of DFT coefficients
X = [X [0] X [1] ... X [N − 1]]T .

Consider now the length-2N signal obtained by interleaving the values of x with zeros

x2 = [x [0] 0 x [1] 0 x [2] 0 ... x [N − 1] 0]T

.
Express X2 (the 2N -point DFT of x2 ) in terms of X.

Solution 8.
Knowing that

2π 2π
 WNnk , 0≤k <N
2nk −j 2nk −j N nk
W2N =e 2N =e =
n(k −N )
WN , N ≤ k < 2N

5
we get
 PN −1
nk
 n=0 x [n]WN = X [k ], 0≤k <N
X 2 [k ] =
 PN −1 n(k −N )
n=0 x [n]WN = X [(k − N )], N ≤ k < 2N

Exercise 9. The Structure of DFT Formulas.


The DFT and IDFT formulas are similar, but not identical. Consider a length-N signal x with x [n], N =
0, . . ., N − 1. What is the length-N signal y [n] obtained as

y = DFT{DFT{x}}?

In other words, what are the effects of applying twice the DFT transform?

Solution 9.
Let X = DFT{x}. We have:
N
X −1

y [n] = X [k ]e − j N nk
k =0
N
X −1§ N
X −1 ª
2π 2π
= x [i ]e − j N ik e −j N nk

k =0 i =0
N
X −1 N
X −1

= x [i ] e − j N (i +n)k .
i =0 k =0

Now,
N −1 
X
−j 2π
N (i +n)k
N for (i + n) = 0, N , 2N , 3N , . . .
e = = N δ[(i + n) mod N ]
0 otherwise
k =0

so that
N
X −1
y [n] = x [i ]N δ[(i + n) mod N ]
i =0

N x [0] for n = 0
=
N x [N − n] otherwise.

In other words, if x = [1 2 3 4 5]T then

DFT{DFT{x}} = 5 · [1 5 4 3 2]T = [5 25 20 15 10]T

Exercise 10. DFT of the Autocorrelation.


Consider a sequence x of finite length N . Let X denote the N point DFT of x and define the circular autocor-
relation sequence rx as
N
X −1
r x [m ] = x [n]x ∗ [(n − m ) mod N ].
n=0

Express rx in terms of X. [Hint: build a signal S [n] = X [n]X ∗ [n], compute its inverse DFT and work back-
wards.]

6
Solution 10.

N −1
1 X 2π
IDFT {S} [m ] = X [k ]X ∗ [k ]e j N k m
N k =0
N −1 • N −1 ˜• NX −1 ˜
1 X X 2π 2π 2π
= x [n]e − j N k n x ∗ [l ]e j N l k e j N k m
N k =0 n=0 l =0
N −1 N −1 N −1
1 X X X 2π
= x [n] x ∗ [l ] e j N k (l +m−n)
N n=0 l =0 k =0
N
X −1
= x [n]x ∗ [(n − m ) mod N ]
n=0

Exercise 11. Subsampling the DFT


Consider x ∈ CN with N even and its N -point DFT X. Define an (N /2)-length vector Y as Y [k ] = X [2k ], k =
0, . . ., N /2 − 1. Compute the inverse DFT of Y.

Solution 11.
The IDFT of Y can be expressed as
N
2 −1
1 X 2π
y [n] = Y [l ]e j N /2 nl
N /2 l =0
N
2 −1
2 X 2π
= X [2l ]e j N 2nl
N l =0

Consider the sequence


¨
n 2 if n is even
1 + (−1) =
0 if n is odd

We can rewrite the expression for y [n] as


N −1
1 X  2π
y [n] = 1 + (−1)k X [k ]e j N nk
N k =0
N −1 N −1
1 X 2π 1 X 2π
= X [k ]e j N nk + X [k ]e j N nk e j πk
N k =0 N k =0
N −1 N −1
1 X 2π 1 X 2π N
= X [k ]e j N nk + X [k ]e j N k (n+ 2 )
N k =0 N k =0
N N
= x [n] + x [n + ] n = 0, . . ., −1
2 2

Exercise 12. Plancherel-Parseval Equality.


Let x [n] and y [n] be two complex-valued sequences and X (e j ω ) and Y (e j ω ) their corresponding DTFTs.

7
(a) Show that
1
〈x [n], y [n]〉 = 〈X (e j ω ), Y (e j ω )〉,

where we use the inner products for l 2 (Z) and L 2 ([−π, π]) respectively.
(b) What is the physical meaning of the above formula when x [n] = y [n] ?

Solution 12.
(a) The inner product in l 2 (Z) is defined as

〈x [n], y [n]〉 = Σn x ∗ [n]y [n],

and in L 2 ([−π, π]) as


Z π
〈X (e jω
), Y (e jω
)〉 = X ∗ (e j ω )Y (e j ω )d w.
−π

Thus,
Z π Z π
1 1 ∗
X ∗ (e j ω )Y (e j ω )d w = Σn x [n]e − j ωn Σm y [m ]e − j ωm d w
2π −π
2π −π
Z π
(1) 1
= Σn x ∗ [n]e j ωn Σm y [m ]e − j ωm d w
2π −π
Z π
1
= Σn Σm x ∗ [n]y [m ]e j ω(n−m) d w
2π −π
Z π
(2) 1
= Σn Σm x ∗ [n]y [m ] e j ω(n−m) d w
2π −π
(3) ∗
= Σn x [n]y [n],
where (1) follows from the properties of the complex conjugate, (2) from swapping the integral and the
sums and (3) from the fact that
Zπ 
1 j ω(n−m) 1 if m = n
e dw = .
2π −π 0 if m 6= n

(b) 〈x [n], x [n]〉 corresponds to the energy of the signal in the time domain; 〈X (e j ω ), X (e j ω )〉 corresponds
to the energy of the signal in the frequency domain. The Plancherel-Parseval equality illustrates an
energy conservation property from the time domain to the frequency domain. This property is known
as the Parseval’s theorem.

Exercise 13. DTFT properties.


Derive the time-reverse and time-shift properties of the DTFT.

Solution 13.
We have:

X ∞
X
x [−n]e − j ωn = x [m ]e j ωm
n=−∞ m=−∞

X
= x [m ]e − j (−ω)m
m=−∞
−jω
= X (e )

8
with the change of variable m = −n. Hence, we obtain that the DTFT of the time-reversed sequence x [−n]
is X (e − j ω )
Similarly:

X ∞
X
x [n − n0 ]e − j ωn = x [m ]e − j ω(m+n0 )
n=−∞ m=−∞

X
= e − j ωn0 x [m ]e − j ωm
m=−∞
− j ωn0 jω
= e X (e )

with the change of variable m = n −n0 . We, therefore, obtain the DTFT of the time-shifted sequence x [n −n0 ]
is e − j ωn0 X (e j ω )

You might also like