Вы находитесь на странице: 1из 34

SOLUTIONS MANUAL

to accompany

Digital Signal Processing:


A Computer-Based
Approach
Fourth Edition

Sanjit K. Mitra
Prepared by
Chowdary Adsumilli, John Berger, Marco Carli,
Hsin-Han Ho, Rajeev Gandhi, Martin Gawecki, Chin Kaye Koh,
Luca Lucchese, Mylene Queiroz de Farias, and Travis Smith

Copyright 2011 by Sanjit K. Mitra. No part of this publication may


be reproduced or distributed in any form or by any means, or stored in
a database or retrieval system, without the prior written consent of
Sanjit K. Mitra, including, but not limited to, in any network or other
electronic Storage or transmission, or broadcast for distance learning.

Not for sale.

Chapter 5
5.52

(a) From the circular frequency-shifting property of the DFT given in Table 5.3:
IDFT{X[k m1 N } = W Nm1n x[n], IDFT{X[k m2 N } = W Nm 2 n x[n].
Hence: w[n] = IDFT{W [k]} = IDFT{X[k m1 N } + X[k m2 N }

= W Nm1n x[n] + W Nm 2 n x[n] = (W Nm1n + W Nm2 n )x[n].

(b) We can rewrite G[k] as follows:

1
2

G[k] = (X[k] + (1) k X[k]) =

1
2

( X[k] + W N(N / 2)k X[k]).

Using the circular time-shifting property of the DFT given in Table 5.3:

1
N

g[n] = IDFT{G[k]} = x[n] + x[n N .

2
2

(c) Using the modulation property of the DFT given in Table 5.3:

5.53

y[n] = IDFT{Y[k]} = N x[n] x[n] = N x 2 [n].

(a) Given: h[n] = g[n 3 8 ].

Hence: H[k] = W83k G[k] = e j 6 k /8G[k] = e j 3k / 4 G[k]


={H[0], e j 3 / 4 H[1], e j 3 / 2 H[2], e j 9 / 4 H[3], e j 3 H[4],
e j15 / 4 H[5], e j 9 / 2 H[6], e j 21 / 4 H[7]}
= {3 + j4, e j 3 / 4 (2 j7), e j 3 / 2 (4 + j), e j 9 / 4 (5 j2),
5e j 3 , e j15 / 4 (4 + j3), e j 9 / 2 (4 j6), e j 21 / 4 (3 + j2)}

(b) Given H[k] = G[k + 5 8 ].


5n
5n /8
Hence,
g[n]
h[n] = W8 g[n] = e

= {g[0], e5 /8 g[1], e10 /8 g[2], e15 /8 g[3], e20 /8 g[4],

e25 /8 g[5], e30 /8 g[6], e35 /8 g[7]}


= {1 j7, e5 /8 (3 + j2), e10 /8 (2 + j7), e15 /8 (2 + j2), e20 /8 (8 + j2),
e25 /8 (4 j), e30 /8 (1+ j3), e35 /8 ( j1.5)}.

Not for sale.

N 1

(a) Given: y[n] = g[n] + h[n]. Therefore: Y[k] = y[n]W Nnk

5.54

N 1

N 1

n=0

n=0

n=0

= g[n]W Nnk + h[n]W Nnk = G[k] + H[k].

N 1

(b) Given: x[n] = g[n no N ]. Therefore: X[k] = g[n no N ]W Nnk


n=0

n o 1

N 1

= g[N + n no ]W Nnk + g[n no ]W Nnk


n=n o
n=0

N 1

(n+n o N )k

g[n ]W N

n=N n o

k o n

(n+n o )k

g[no ]W N

n=0

(c) Given: u[n] = W N

N n1

N 1

= W Nn o k g[n]W Nnk = W Nn o k G[k].


n=0

N 1

N 1

n=0

n=0

(kk )n
g[n]. Therefore: U[k] = u[n]W Nkn = g[n]W N o

N 1
(kk )n
g[n]W N o , if k ko ,

= N n=0
1
g[n]W (N +kko )n ,if k < k .
o
N
n=0

G[k ko ], if k k o,
= G[k ko N ].
Thus: U[k] =
G[N + k ko ], if k <k o,

N 1

N 1
n=0

(d) Given: h[n] = G[n]. Therefore: H[k] = h[n]W Nnk = G[n]W Nnk

N 1 N 1

N 1

n=0
N 1

n=0 r=0

r=0

n=0

= g[r]W NnrW Nkr = g[r] W N(k+r)n .

The second sum is nonzero only if k = r = 0 or if r = N k and

Hence:

Ng[0], if k = 0,
H[k] =
= Ng[k N ].
Ng[N k], if k > 0,
N 1

(e) Given: u[n] = g[m]h[n m N ]. Therefore


m=0

N 1 N 1

N 1

N 1

n=0 m=0
N 1

m=0

n=0

U[k] = g[m]h[n m N ]W Nnk = g[m] h[n m N ]W Nnk

= g[m]H[k]W Nmk = H[k]G[k].


m=0

Not for sale.

5.55

Using the concept similar to Example 5.12, we first calculate the 4-point DFT X[k] of
x[n]:
X[0] 1
1
1
1 2 4

j 2 1+ j5
X[1] = 1 j 1
=
.
X[2] 1 1
1
1 1 2

j
1 j 3 1 j5
X[3] 1
Next, we use the relationship:

W [k] {20, 7 + j9,


Y[k] =
=
X[k]
{4, 1+ j5,

10, 7 j9}
= {5,
2, 1 j5}

2 j,

2 + j}.

5,

Finally, we compute the inverse DFT y[n] of Y[k]:

5.56

y[0]

y[1] =
y[2]

y[3]

1 1
4 1

1
j
1
j

1
1
1
1

j
1

5 1


2 j = 3 .
5 1


2 + j 2

Similarly to the solution of Problem 5.55, we first calculate the DFT X[k] of x[n]:

X[0] 1
1
1
1 1 2

j 1 3 + j
X[1] = 1 j 1
=
.
X[2] 1 1
1
1 2 4

j
1 j 2 3 j
X[3] 1
Next, we use the relationship:

W [k] {8, 6 j8,


Y[k] =
=
X[k] {2, 3 + j,

8,
4,

6 + j8}
= {4,
3 j}

1 j3,

2,

1+ j3}.

Finally, we compute the inverse DFT y[n] of Y[k]:

y[0]

y[1] =
y[2]

y[3]

1 1
4 1

j
1
j

1
1
1

j
1

4 2


1 j3 = 2 .
2 1


1+ j3 1

Not for sale.

5.57

To prove Parseval's Theorem, we show that:


N 1
N 1
1 N 1 N 1
1 N 1
g[n]h *[n] =
G[k]W Nnk h *[n] =
G[k] h *[n]W Nnk
N n=0 k=0
N k=0
n=0
n=0
N
1
1
=
G[k]H *[k].
N k=0

The DFT R xy [k] of the circular cross-correlation rxy [] is given by:

5.58

5.59

N 1
N 1 N 1

R xy [k] = rxy []W Nk = x[n] y[ + n N W Nk

=0
=0 n=0

N 1
N 1
N 1
N 1

= x[n] y[ + n N ]W Nk = x[n] y[m]W N(mn)


=0
n=0
=0

n=0
N 1
N 1

= x[n]W Nnk y[m]W Nm = X *[k]Y[k].


=0

n=0

Note X[k] is the MNpoint DFT of the sequence xe[n] obtained from x[n] by appending
it with M(N 1) zeros. Thus, the length-MN sequence y[n] is given by:
M 1

y[n] = xe [n N MN ], 0 n MN 1.
=0

M 1 Nk
M 1 k
Taking the MN-DFT of both sides we get: Y[k] = W MN
X[k] = W N X[k].
=0

=0

5.60

Using the properties of the DFT:


(a)
(b)

X[0] = x[n] = 6.44,


n=0
9

X[5] = (1) n x[n] = 30.66,


n=0

(c)

X[k] = 10 x[0] = 62.9,


k=0

(d)

The inverse DFT of e j 3k / 5 X[k] is x[n 310 ]. Thus,


9

e j 3k / 5 X[k] = 10 x[0 310 ] = 10 x[7] = 9.3,

k=0

9
9

2
2 = 10
x[n] = 4913.4.
(e) From Parsevals relation, X[k]

5.61

k=0

n=0

Using the properties of the DFT, we first determine the missing samples:

Not for sale.

X[7] = X *[712 ] = X *[5] = 19 + j16,


X[8] = X *[812 ] = X *[4] = 9 j8,
X[9] = X *[912 ] = X *[3] = 6 j7,
X[10] = X *[1012 ] = X *[2] = 10 j4,
X[11] = X *[1112 ] = X *[1] = 18 + j21.

(a)

1 11
X[k] = 3.25,
12 k=0
1 11
x[6] =
(1) k X[k] = 4.9167,
12 k=0
x[0] =

(b)

11

(c)

x[n] = X[0] = 12,

n=0

The inverse DFT of e jk / 3 x[n] is X[k 210 ]. Thus,

(d)

11

e j 2 n / 3 x[n] = X[0 212 ] = X[10] = 10 j4,

n=0

12

2
x[n] 2 = 1 12
(e) From Parsevals relation,
X[k] = 426.75.
12 n=0
k=0

5.62

As the given sequence is real valued, X[k] = X *[k158 ] = X *[158 k].


= X *[143] = 4.13 j8.27
X[143] = 4.13 + j8.27,
X[15] = X *[158 15]
X[41] = X *[158 41] = X *[117] = 3.15 j2.04 X[117] = 3.15 + j2.04,
= 9.08
X[78] = 9.08,
X[80] = X *[158 80] = X *[78]
X[39] = 6.1+ j2.8,
X[119] = X *[158 119] = X *[39] = 6.1 j2.8

X[9] = 7.3 j9.5,


X[151] = X *[158 151] = X *[9] = 7.3 + j9.5

] = 4.13 + j8.27, X[k ] = 3.15 + j2.04.


X[k1 ] = 6.1+ j2.8, X[k 2 ] = 7.3 j9.5, X[k
3
4

those given above we conclude:


(a)
Comparing these 4 DFT samples with

k1 = 12, k 2 = 61, k 3 = 123, k 4 = 165.

(b)
(c)

The DC value is X[0] = 31

158

n=0

5.63

The energy is: x[n] =

1 158
2
X[k] = 10.2512
158 k=0

As the given sequence is real valued, X[k] = X *[k134 ] = X *[134 k].


X[0] = 3.42 +j .
X[121] = 4.52 j7.91,
X[17] = X *[134 13] = X *[121] = 4.52 + j7.91

X[87] = j3.78,
X[47] = X *[134 47] = X *[87] = j3.78
X[67] = X *[134 67] = X *[67] = 4.5 + j X[67] = 4.5 j,

Not for sale.

X[79] = X *[134 79] = X *[55] = 3.6 + j


X[108] = X *[134 108] = X *[26] = + j7.56
X[k1 ] = 3.6 + j5.4,

X[55] = 3.6 + j,
X[26] = j7.56,

X[k3 ] = j7.91, X[k4 ] = 3.7 j7.56.

Comparing these 4 DFT samples with those given above we conclude:

(a)

X[k2 ] = j3.78,

k = 55, k = 87,k = 121, k = 26.


1
2
3
4

(b)

Comparing the samples above:

(c)
(d)

= 0, = 0, = 5.4,
The DC value is X[0] = 3.42

133

1 133
2
X[k] = 3.3765.
134 k=0

9k
Y[k] = W 43k X[k] = W12
X[k]. Therefore, y[n] = x[n 912 ].

Thus,

y[0] = x[3] = 4,
y[1] = x[4] = 6 j2,
y[2] = x[5] = 5,
y[3] = x[6] = j9,
y[4] = x[7] = 2 j4,
y[5] = x[8] = 10 j5

5.65

The energy is: x[n] =


n=0

5.64

3.7.

y[6] = x[9] = 1+ j2

y[7] = x[10] = 5 j5,


y[8] = x[11] = 0,
y[9] = x[0] = 3 + j5,
y[10] = x[1] = 4 + j6
y[11] = x[2] = 8 j3

As h[n] is a real sequence, we have H[k] = H *[k12 ] = H *[12 k].


Hence the remainingsamples of {H[k]} are given by
H[7] = H *[5] = 6.8 j5.46,
H[8] = H *[4] = 1+j24.25,
H[9] = H *[3] = 9 + j5,
H[10] = H *[2] = 9 + j3.46,
H[11] = H *[1] = 17.19 + j1.46.

5n
g[n] = h [n 1712 ] = h [n 512 ] = W12 h[n].

Therefore: G[k] = H[k 512 ], 0 k 11.

Thus:

Not for sale.

G[0] = H[512 ] = H[7] = 6.8 j5.46,


G[1] = H[1 512 ] = H[8] = 1+ j24.25,
G[2] = H[2 512 ] = H[9] = 9 + j5,
G[3] = H[3 512 ] = H[10] = 9 + j3.46,
G[4] = H[4 512 ] = H[11] = 17.19 + j1.46,
G[5] = H[5 512 ] = H[0] = 4,
G[6] = H[6 512 ] = H[1] = 17.19 + j1.46,
G[7] = H[7 512 ] = H[2] = 9 + 3.46,
G[8] = H[8 512 ] = H[3] = 9 + j5,
G[9] = H[9 512 ] = H[4] = 1+ j24.25,
G[10] = H[10 512 ] = H[5] = 6.8 j5.46,
G[11] = H[11 512 ] = H[6] = 6.

5.66 The minimum value of N must be the maximum of the lengths of the three sequences,
x[n], y[n], and w[n] : N = max(R, M, L).

We next zero-pad each of the above sequences to be length N resulting in


x[n],
y[n],
0 n R 1,
0 n M 1,

xe [n] =
ye [n] =
R n N 1,
M n N 1,
0,
0,
w[n],
0 n L 1,
we [n] =
L n N 1.
0,

N ye [n] O
N we [n] are as follows:
The steps involved in determining v[n] = xe [n] O

(1) Form the N-point DFTs, X e [k], Ye [k], and We [k] of the sequences xe [n], ye [n],
and we [n], respectively,
(2) Form the product V[k] = X e [k]Ye [k]We [k], and

(3) Determine the N-point inverse DFT of V[k] to yield v[n].

N
Given: y[n]
= x[5n], 0 n 1.
5

5.67

N
1
5

N
1
5

Therefore: Y[k] = y[n]W Nnk/ 5 = x[5n]W Nnk/ 5 .

n=0

n=0
1 N 1
1 N 1
We can write: x[n] =
X[m]W N5mn =
X[m]W Nmn
/5 .
N
N
m=0
m=0

Hence:

Y[k] =

N
1
5 N 1

N 1

N
1
5

1
1
nk
.
X[m]W Nmn
X[m] W N(km)n
/ 5 WN / 5 =
/5
N n=0 m=0
N m=0
n=0

Since:

Not for sale.

N
1
5

N
,
=
5
W N(km)n
/5

n=0
0,

m = k, k +

N
,
5

k+

2N
3N
4N
,k +
,k +
,
5
5
5

k + N,

elsewhere.

Therefore:

1
N
2N
3N
4N

Y[k] = X[k] + X[k + ] + X[k +


] + X[k + ] + X[k +
] + X[k + N].

5
5
5
5
5

5.68

From Eqn. (5.49) we have y[n] = x[n + 5m], 0 n 4.


m=

Therefore: y[n] = x[n + 5] + x[n] + x[n 5] = {5,

9,

13,

8,

1}, 0 n 4.

For v[n] = x[n] + jy[n], we can write the DFTs of x[n] and y[n] as follows:

5.69

1
2

X[k] = {V[k] + V *[k 8 ]}, Y[k] =

1
{V[k] V
2j

*[k 8 ]}.

where:

V[k] = [2 + j6,

6 + j4,

3 + j5,

V *[k 8 ] = [2 j6,

4 + j7,

1+ j8,
j8,

7 j3,

2 + j3,
2 j3

7 + j3,

j8,

1 j8,

4 j7],

6 j4,

3 j5].

Therefore, using Eqns. (5.117) and (5.118) we get

X[k] =

1
{V[k] + V
2

= [2,
Y[k] =

3.5 + j6,

1
{V[k] V
2j

= [6,

*[k 8 ]}

4 + j6,

3 + j2.5,

2,

3 j2.5,

3 j6,

3,

5.5 j4,

2 + j3,

3.5 j6],

*[k 8 ]}

1+ j0.5,

2 j3,

5.5 + j4,

1 j0.5].

Using MATLAB we first compute the IDFT of V[k] yielding


v =
Columns 1 through 4
1.8750 + 1.7500i
0.0910 - 0.0214i

-2.9142 - 0.8195i

-2.1250 + 2.5000i

Columns 5 through 8

Not for sale.

-1.3750 - 0.5000i
3.0910 - 0.7286i

-0.0858 + 3.0695i

-0.3750 + 0.7500i

Its real and imaginary parts obtained using MATLAB are given by
x =
1.8750
0.3750

-2.9142
3.0910

-2.1250

-0.0910

-1.3750

-0.0858

-0.8195
-0.7286

2.5000

-0.0214

-0.5000

3.0695

y =
1.7500
0.7500

The DFTs of x and y obtained using MATLAB are


X =
Columns 1 through 4
-2.0000
3.0000 + 2.5000i

3.5000 + 6.0000i

3.0000 + 6.0000i

3.0000 - 2.5000i

3.0000 - 6.0000i

Columns 5 through 8
-2.0000
3.5000 - 6.0000i
Y =
Columns 1 through 4
6.0000
5.5000 + 4.0000i

-1.0000 + 0.5000i

-2.0000 - 3.0000i

Columns 5 through 8
3.0000
5.5000 - 4.0000i
-1.0000 - 0.5000i

-2.0000 + 3.0000i

which are seen to be exactly same as those computed analytically.


5.70

(a) Define: v[n] = g[n] + j h[n] = {3 + j5,

2 + j7,

5 j3,

4 + j8}.

Therefore:

Not for sale.

10

V[0] 1


V[1] = 1
V[2] 1


V[3] 1

1
j
1
j

1
1
1
1

1 3 + j5 2 + j17

j 2 + j7 1+ j10
=
15 j3 14 j13

j 4 + j8 3 + j6

Thus: V[k] = {4 + j3, 4 j3, 6 j3, 6 j5}.

V *[k 4 ] = {4 + j3, 6 + j5, 6 + j3, 4 + j3}.

Therefore, using Eqns. (5.117) and (5.118) we get


1
V[k] + V *[k 4 ] = {2,
2
1
H[k] =
V[k] V *[k 4 ] = {17,
2j

G[k] =

(b) Define:
u[n] = x[n] + j y[n] = {4 + j6, 3 j4,
The 4-point DFT U[k] of u[n] is thus given by

U[0] 1


U[1] = 1
U[2] 1


U[3] 1

1
j
1
j

1
1
1
1

2 + j2,

14,

2 j2},

8 + j,

13,

8 j}.

5 + j5}.

1+ j2,

1 4 + j6 11+ j9

j 3 j4 4 + 6 j
=
,
11+ j2 5 + j7

j 5 + j5 14 + j2

Thus:

U[k] = {11+ j9, 4 + j6, 5 + j7, 14 + j2},


U *[k 4 ] = {11 j9, 14 j2, 5 j7, 4 j6}.

Therefore, using Eqns. (5.117) and (5.118) we get

1
X[k] = (U[k] + U *[k 4 ]) = {11,

5 + j2,

5,

(U[k] U *[k 4 ]) = {8,

4 + j9,

7,

Y[k] =

2
1
2j

u[n] = x[n] + j h[n] = {3 j,


Define:

5.71


U[0] 1


U[1] = 1
U[2] 1


U[3] 1

j
1
j

1
1
1

2 + j4,

1+ j2,

5 j2},

4 j9}.

4 j5}.

1 3 j 6

j 2 + j4 11+ j3
=
,
1 1+ j2 2 + j2

j 4 j5 7 j9

Thus:

Not for sale.

11

U[k] = {6, 11+ j3, 2 + j2, 7 j9},


U *[k 4 ] = {6, 7 + j9, 2 j2, 11 j3}.

Therefore, using Eqns. (5.117) and (5.118) we get


X[k] =

H[k] =

1
U[k] + U *[k 4 ] = {6,
2
1
U[k] U *[k 4 ] = {0,
2j

2 + j6,

2 j6},

2,

3 j9,

2,

3 + j9}.

5.72 This computation can be done by splitting X[k] and y[n] into their real even, real odd,
imaginary even, and imaginary odd parts, as shown in the solution of Problem 5.38:

(
) (
)
ev
od
ev
od
X[k] = ( X re
[k] + X re
[k]) + j ( X im
[k] + X im
[k]).
od
ev
od
y[n] = y ev
re [n] + y re [n] + j yim [n] + yim [n] ,

ev
od
From the fact that x[n] is real, we know that: yim
[n] = yim
[n] = 0.

Also, from the repeated application of a DFT, we know that DFT{ X[k]} = N x[n N ].
od
Thus we can define: u[n] = jy ev
re [n] + y re [n] + X[n].

Then, taking the DFT, we get:

= Re{Z[k]} + Im{Z[k]} = N x[n ] + Y[k].


U[k]
N

5.73

From these, x[n] and Y[k] can be directly recovered by taking the real and imaginary
parts of U[k].
For this problem, x[n] and X[k] are length N, while v[n] and V[k] are length 2N.
2N 1

N 1

2N 1

n=0

n=0

n=N 1

nk
nk
V[k] = v[n]W 2N
= x[n]W 2N
+

nk
.
x[n 1 N ]W 2N

Replacing m = n + N in the second summation:

N 1

N 1

n=0
N 1

m=0
N 1

n=0

m=0

V[k] = x[n]W 2N nk + x[ m 1 N ]W 2N (m+N )k


nk
mk Nk
= x[n]W 2N
+ x[m 1 N ]W 2N
W 2N

Not for sale.

12

N 1

k N 1

n=0

m=0

nk
mk
= x[n]W 2N
+ (1) x[m 1 N ]W 2N
.

From here, the computation proceeds on the even part and the odd part of V[k], for the
indices 0 N 1:
2N 1

2n
V[2] = x[n]W 2N
+ (1)
n=0
N 1

k 2N 1

2n
x[n 1 N ]W 2N

n=0
N
k 1

= x[n]W Nn + (1) x[n 1 N ]W Nn


n=0

n=0

= X[k] + (1) W N X[n 1 N ].

V[2 + 1] = 2N1 x[n]W n(2+1) + 1 k 2N1 x[n 1 ]W n(2+1)


( )
N
2N
2N
n=0
n=0

N 1

k N 1

n=0
N 1

n=0
k N 1

n
2n
n
2n
= x[n]W 2N
W 2N
+ (1) x[n 1 N ]W 2N
W 2N

n
n
= x[n]W 2N
W Nn + (1) x[n 1 N ]W 2N
W Nn .
n=0

n=0

We first write the DFT of X e [k] and then look separately at it's odd and even
components. Now

5.74

2N 1

nk
X e [k] = x[n]W 2N
.
n=0

Then for the indices 0 N 1,

2N 1

N 1

2n
X e [2] = x[n]W 2N
= x[n]W Nn = X[]
n=0
n=0

2N 1

N 1

n=0

n=0

(2+1)n
n
X e [2 + 1] = x[n]W 2N
= x[n]W 2N
W Nn .

We first form y[n] as follows:


y[n] = g[n] + jh[n] = x[2n] + jx[2n + 1]
= {2 + j4, 6 + j8, 1+ j3, 5 + j7}, 0 n 3.

Its 4-point DFT is thus given by

5.75

Not for sale.

13

Y[0] 1


Y[1] = 1
Y[2] 1


Y[3] 1
Thus

1
j
1
j

1
1
1
1

1 2 + j4 14 + j22

j 6 + j8 2
=
.
11+ j3 8 j8

j5 + j7 j2

Y[k] = {14 + j22, 2, 8 j8,


j2},
Y *[k 4 ] = {14 j22, j2, 8 + j8,

2}.

Next, we compute the DFTs of g[n] and h[n] as follows:


1
(Y[k] + Y *[k 4 ]) = {14, 1 j, 8, 1+ j},
2
1
H[k] = (Y[k] Y *[k 4 ]) = {22, 1 j, 8, 1+ j}.
2j

G[k] =

Finally, we compute each sample of X[k] using the fact that:

2N 1

N 1

N 1

2nk
(2n+1)k
X[k] = x[n]W 2N nk = x[2n]W 2N
+ x[2n + 1]W 2N
n=0
N 1

n=0
N 1

n=0
N 1

N 1

k
k
= g[n]W Nnk + h[n]W NnkW 2N
= g[n]W Nnk + W 2N
h[n]W Nnk
n=0

n=0
n=0
k
= G[k N ] + W 2N H[k N ] = G[k 4 ] + W8k H[k 4 ],

n=0

0 k 7.

Thus:

X[0] = G[0] + H[0] = 36,

X[1] = G[1] + W81H[1] = 1 j2.4142,


X[2] = G[2] + W82 H[2] = 8 + j8,

X[3] = G[3] + W83H[3] = 1 j0.4142,

X[4] = G[0] + W84 H[0] = 8,

X[5] = G[1] + W85H[1] = 1+ j0.4142,

X[6] = G[2] + W86 H[2] = 8 j8,

X[7] = G[3] + W87 H[3] = 1+ j2.4142.

5.76 Given g[n] = {3, 2, 5}, 0 n 2 and h[n] = {4, 3, 1, 4}, 0 n 3.

(a)
y L [0] = g[0]h[0] = 8,
y L [1] = g[0]h[1] + g[1]h[0] = 16,

+ g[2]h[0] = 12,
y L [2] = g[0]h[2] + g[1]h[1]
y L [3] = g[0]h[3] + g[1]h[2] + g[2]h[1] = 1

y L [4] = g[1]h[3] + g[2]h[2] = 7

y L [5] = g[2]h[3] = 20

Not for sale.

14

(b)

ge [n] = {3, 2, 5, 0}.


yC [0] = ge [0]h[0] + ge [1]h[3] + ge [2]h[2] + ge [3]h[1]
= g[0]h[0] + g[1]h[3] + g[2]h[2] = 15,
yC [1] = ge [0]h[1] + ge [1]h[0] + ge [2]h[3] + ge [3]h[2]
= g[0]h[1] + g[1]h[0] + g[2]h[3] = 4,
yC [2] = ge [0]h[2] + ge [1]h[1] + ge [2]h[0] + ge [3]h[3]

= g[0]h[2] + g[1]h[1] + g[2]h[0] = 12,


yC [3] = ge [0]h[3] + ge [1]h[2] + ge [2]h[1] + ge [3]h[0]

= g[0]h[3] + g[1]h[2] + g[2]h[1] = 1.

calculate the circular convolution, we first compute the DFTs and form their
(c) To
products samplewise:

Ge [0] 1 1 1 1 2 6

Ge [1] = 1 j 1 j 1 = 7 j3,
Ge [2] 1 1 1 1 3 0

Ge [3] 1 j 1 j 0 7 + j3

H[0] 1 1 1 1 2 1

H[1] = 1 j 1 j 4 = 3 j2.
H[2] 1 1 1 1 2 1

H[3] 1 j 1 j 1 3 + j2

YC [0] Ge [0]H[0] 6

YC [1] = Ge [1]H[1] = 27 + j5.


YC [2] Ge [2]H[2] 0

YC [3] Ge [3]H[3] 27 j5

We then determine the IDFT of YC [k] :

yC [0]

y
[1]
C

=
yC [2]

yC [3]

1 1 1 1 6 15


1 1 j 1 j27 + j5 4
=
.
4 1 1 1 1 0 12


1 j 1 j 27 j5 1

(d) The extended sequences are as follows:

ge [n]= [3, 2, 5, 0, 0, 0], he [n] = [ 4, 3, 1, 4, 0, 0].


yC [0] = ge [0]he [0] + ge [1]he [5] + ge [2]h e [4] + ge [3]he [3] + ge [4]he [2] + ge [5]he [1]
= g[0]h[0] = 8 = y L [0],

Not for sale.

15

yC [1] = ge [0]he [1] + ge [1]he [0] + ge [2]h e [5] + ge [3]he [6] + ge [4]he [3] + ge [5]he [2]
= g[0]h[1] + g[1]h[0] = 16 = y L [1],

5.77

yC [2] = ge [0]he [2] + ge [1]he [1] + ge [2]h e [0] + ge [3]he [5] + ge [4]he [4] + ge [5]he [3]
= g[0]h[2] + g[1]h[1] + g[2]h[0] = 12 = y L [2],
yC [3] = ge [0]he [3] + ge [1]he [2] + ge [2]h e [1] + ge [3]he [0] + ge [4]he [5] + ge [5]he [4]
= g[0]h[3] + g[1]h[2] + g[2]h[1] = 1 = y L [3],
yC [4] = ge [0]he [4] + ge [1]he [3] + ge [2]h e [2] + ge [3]he [1] + ge [4]he [0] + ge [5]he [5]
= g[1]h[3] + g[2]h[2] = 7 = y L [4],
yC [5] = ge [0]he [5] + ge [1]he [4] + ge [2]h e [3] + ge [3]he [2] + ge [4]he [1] + ge [5]he [0]
= g[2]h[3] = 20 = y L [5].

Denote N = max(R, M, L).


(1) Extend the length of the three sequences to N by zero-padding:

x[n], 0 n R 1,
y[n], 0 n M 1,
xe [n] =
ye [n] =
R n N 1,
M n N 1,
0,
0,
w[n], 0 n L 1,
we [n] =
L n N 1.
0,

(2) Compute the N-point DFTs of the above three extended sequences:
X e [k] = DFT{ xe [n]}, Ye [k] = DFT{ ye [n]}, We [k] = DFT{we [n]}.

(3) Multiply the three DFTs together, forming U[k] = X e [k]Ye [k]We [k].

(4) The inverse DFT u[n] of U[k] yields the result, i.e., u[n] = x[n] O
* y[n] O
* w[n].

Since the length of x[n] is 3 and the length of w[n] is 4, the length of y[n] is 2. Extend
the length of the sequence x[n] to 4 by zero-padding: xe [n] = {2, 1, 2, 0}.

Form the 4-point DFTs of xe [n] and w[n]:

5.78

X e [0] 1 1 1 1 2 5



X
[1]
1

j
1
j
e =

1 = j,
X e [2] 1 1 1 12 3



X e [3] 1 j 1 j 0 j

Not for sale.

16

W [0] 1 1 1 1 4 5

W [1] = 1 j 1 j 0 = 1+ j2.
W [2] 1 1 1 13 9

W [3] 1 j 1 j 2 1 j2
The 4-point DFT Ye [k] of the extended sequence ye [n] = { y[0], y[1], 0, 0}
Is then given by
5, 1+ j2, 9, 1 j2}
Y3[k] = {
= {1, 2 j, 3, 2 + j}.
{5, j, 3, j}

The 4-point inverse DFT of Ye [k] yields y[n]:

y[0]

=
y[1]
y[2]

y[3]
5.79

1 1 1 1 1

1 1 j 1 j2
4 1 1 1 1 3

1 j 1 j 2 +

2

j 1
=
y[n] = {2, 1}, 0 n 1.
0

j 0

For this problem, we use the definitions of the overlap-add and overlap-save methods,
each defined in Section 5.10.3:

(a) Overlap-add method: Since the impulse response is of length 110 and the DFT size
to be used is 128, the number of data samples required for each convolution will be 128
109 = 19. Thus the total number of DFTs required for the length-1300 data sequence
is:
1300
19 = 69.
Also, the DFT of the impulse response needs to be computed once. Hence, the total
number of DFTs used are 69 + 1 = 70. The total number of IDFTs is 69.

(b) Overlap-save method: In this case, since the first 110 1 = 109 points are lost, we
need to pad the data sequence with 109 zeros for a total length of 1409. Again, each
convolution will result in 128 109 = 19 values. Thus the total number of DFTs
required for the data is:
1409
19 = 75.
Again, 1 DFT is required for the impulse response. The total number of DFTs used is
75 + 1 = 76. The total number of IDFTs used is 75.

5.80

N 1

Given the definition of the GDFT: X GDFT [k,a,b] = x[n]e

2 (n+a)(k+b)
N
.

n=0

Not for sale.

17

The inverse GDFT is computed as follows:


j
1 N 1
x[n] =
X[k]e
N k=0

2 (n+a)(k+b)
N

j
1 N 1 N 1
=
x[r] e
N k=0 r=0

5.81

N 1 j
1 N 1
=
x[r] e
N r=0
k=0

As from Eqn. (5.23):

N 1

j
1 N 1 N 1
=
x[r] e
N k=0 r=0

2 (n+ara)(k+b)
N
2 (nr)(k+b)
N

2 (nr)(k+b)
N

k=0

2 (r+a)k+b)
2 (n+a)k+b)
j
N
N
e

j
1 N 1 N 1
=
x[r] e
N k=0 r=0

2 (nr)(k+b)
N

1
x[n] N = x[n],
N
N, if n = r,
=
0, otherwise.

Given the sequence: x[n] = {a, b, c, d}. The whole-sample anti-symmetric


extension is given by:

xWSWA [n] = { , 0, d, c, b, a, b, c, d, 0, d, c, b, a, b, c, d,
0,
d, c, b, a, b, c, d, 0, d, c, b, a, b, c, d, }.

One period of the above sequence is given by:

5.82

y[n] = {a, b, c, d, 0, d, c, b, a, b, c, d, 0, d, c, b}.

Given the sequence: x[n] = {a, b, c, d}. The half-sample anti-symmetric extension
is given by:

x HSHA [n] = {, d, c, b, a, a, b, c, d, d, c, b, a, a, b, c, d,
d, c, b, a, a, b, c, d, d, c, b, a, a, b, c, d, }.

One period of the above sequence is given by:

y[n] = {a, b, c, d, d, c, b, a, a, b, c, d, d, c, b, a}.


DCT

5.83

DCT

Given: g[n] GDCT [k], h[n] H DCT [k]

(a) x[n] = g[n] + h[n]. Thus:

N 1

X DCT [k] = 2x[n]cos

n=0

N 1
k(2n+1)
k (2n+1)
= 2( g[n] + h[n]) cos
2N
2N
n=0

Not for sale.

18

N 1

= 2 g[n]cos
n=0

N 1
k (2n+1)
k (2n+1)
+ 2 h[n]cos
2N
2N
n=0

= GDCT [k] + H DCT [k].


N 1

(b) Now: GDCT [k] = g[n]cos


n=0

N 1
k (2n+1)
k (2n+1)
G*DCT [k] = g *[n]cos
.
2N
2N
n=0

DCT

Therefore, g *[n] G*DCT [k].

(c)
Note that:

N,

N 1

k (2n+1)
m(2n+1)
cos
= N/2,
cos
2N
2N

n=0

) (

if k = m = 0,
if k = m and k 0,
, otherwise.

Thus:

g[n]g *[n] =

1 N 1 N 1
N

*
[m]cos
[k][m]GDCT [k]GDCT

k=0 m=0

) (

(2n+1)k
(2n+1)k
cos
.
2N
2N

Therefore:

N 1

g[n] =

n=0

1 N 1 N 1 N 1

*
[m]cos
[k][m]GDCT [k]GDCT

N 2 n=0 k=0 m=0

) (

(2n+1)k
(2n+1)k
cos
.
2N
2N

Using the orthogonality property mentioned earlier we get:

N 1

g[n] =

n=0

5.84

2
1 N 1
[k] GDCT [k] .
2N
k=0

(a) Given the matrix:

13 13 13 13

17
7
7
17
.
HN =
13 13 13 13

7 17 17 7

The matrix H N is orthogonal if H N H tN = cI where I is the 4 4 identity matrix and


c is aconstant. Thus:

Not for sale.

19

13 13 13 13 13 17 13
7 676 0
0
0

17 7
7 1713 7 13 17 0 676 0
0
T

HN HN =
=
.
13 13 13 13 13 7 13 17 0
0 676 0

0
0 676
7 17 17 7 13 17 13 7 0
Hence, the matrix is orthogonal and all its rows have the same L -norm.

(b)

Given the matrix:


1

2
G N =
1

1 1 1

1 1 2
.
1 1 1

2 2 1

Next, we observe:

1 1 1 1 1 2 1 1 4 0 0 0

2 1 1 21 1 1 2 0 10 0 0
t

GN GN =
=
1 1 1 1 1 1 1 2 0 0 4 0

1 2 2 11 2 1 1 0 0 0 10

This shows that the rows of G N are orthogonal but do not have equal L -norms.
5.85

Given the Haar Transform, we prove the following properties:

1 1
(a) H 2 =
.
1 1
We know that:

1 t
1 1 1 1 1 1
H 2H 2 =

=
2
2 1 11 1 0

0
= I .
1 2

H
H 2
H 4 = 2
.
H 2 H 2

Thus:

t
1 t
1 H
H 4 H 4 = 2t
4
4 H
2

t
1 t
1 H /2
H N H N = N
N
N H t
N /2

H t2 H 2

H t2 H 2

H 2 1 4I2
=
H 2 4 4I2

4I2 0
=
4I2 0

1 NI N / 2
H N / 2
=

N NI N / 2
H N / 2

H tN / 2 H N / 2

H tN / 2 H N / 2

0 0 0

1 0 0
= I4 .
0 1 0

0 0 1

NIN / 2
= I .
NIN / 2 N

(b) From Eqn. (5.188):

Not for sale.

20

2
1
t 1
1
x[n] = x t x = H tN XHaar H tN XHaar = 2 XtHaar H N H tN XHaar
N
N
N

N 1
n=0

1
N

XtHaar XHaar =

as H N H tN = N.

5.86

1 N 1
2
X Haar [k] ,
N
k=0

N 1

2 nk
2 nk
.
X DHT [k] =
x[n] cos
+ sin

N
N
n=0

( ) ( )

2 mk
2 mk

We know that: X DHT [k] cos


+ sin

N
N
N 1

2 nk
2 nk
cos 2 mk + sin 2 mk
= x[n] cos
+ sin

N
N
N
N
n=0

( ) ( )
( ) ( ) ( ) ( ).

N 1

2 mk
2 mk

+ sin
Therefore: X DHT [k] cos

N
N
k=0

( ) ( )

= x[n] cos(
+ sin(
cos(
+ sin(
.
)
)
)
)

N 1

N 1

n=0

k=0

2 nk
N

2 nk
N

2 mk
N

2 mk
N

It can be shown that:

N,

N 1
N /2,
2 nk
2 mk
cos
=
cos
N
N
N /2,
k=0
0,

( ) ( )

( ) ( )

k=0

Hence, x[m] =

N 1
2 nk
2 mk
2 nk
2 mk
cos
= cos
sin
= 0.
N
N
N
N
k=0

( ) ( )

sin

5.87

if m = N n,
otherwise,

N, if m = n = 0,

N 1
N /2, if m = n 0,
2 nk
2 mk
sin
=
sin
N
N
N /2, if m = N n,
k=0
0, otherwise,
N 1

if m = n = 0,
if m = n 0,

( ) ( )

1 N 1

2 mk
2 mk
.
+ sin
X DHT [n] cos

N
N
N n=0

( ) ( )

x[n no + N], 0 n no 1,
(a) Given that: y[n] = x[n no N ] =
no n N 1.
x[n no ],

Not for sale.

21

N 1

2 nk
2 nk

YDHT [k] = y[n] cos


+ sin

N
N
n=0

( ) ( )

n o 1

2 nk
2 nk N 1
+ x[n no ]cos 2 nk + sin 2 nk .
= x[n no + N] cos
+ sin

N
N n=n
N
N
n=0
o

( ) ( )

( ) ( )

Replacing n no + N with n in the first sum and n no with n in the second sum we get:

N 1

2 (n+n o )k
2 (n+n o )k
YDHT [k] = x[n] cos
+ sin

N
N
n=N n

o
n o 1

2 (n+n o )k
+ x[n]cos

N
n=0

) (
)
(
) + sin(
)

= x[n] cos(
) + sin( )

= cos(
) x[n]cos( ) + sin( )

+ sin(
) x[n]cos( ) sin( )
= cos(
) X [k] + sin( ) X [k].
(

N 1

2 (n+n o )k
N

n=0

2 n o k N 1
N
n=0

2 n o k
N

(b) The

2 (n+n o )k
N

2 (n+n o )k
N

2 nk
N

2 nk
N

2 n o k N 1
N
n=0
2 n o k
DHT
N

DHT

2 nk
N

2 nk
N

of x[n N ] is X DHT [k].


point DHT

N 1
1 N-1 N 1
(c) To prove Parseval's Equation: x 2 [n] = 2 X DHT [k]X DHT []
N k=0 =0
n=0

N 1

2 nk
2 nk
cos 2 n + sin 2 n .
+ sin
cos
N
N
N
N
n=0

( ) ( ) ( ) ( )

5.88

Using the orthogonality property, we observe that the above product is equal to N if
N 1
1 N 1
2
k = and is
equal to zero if k . Hence: x 2 [n] =
( X DHT [k]) .
N k=0
n=0

1
1
2 nk
2 nk
nk
nk
nk
nk
=
WN WN .
Note: cos
= W N + W N and sin

( ) (
N

( ) (
N

n=0

5.89

1
2

2j

1 N 1
Therefore: X DHT [k] = x[n] W Nnk + W Nnk jW Nnk + jW Nnk
2

+ X[k] j X[N k] + j X[k]).


( X[N k]

show this relation, we start with: y[n] = x[n] O


To
N g[n].

Not for sale.

22

N 1

2 nk
2 nk

+ sin
Thus: YDHT [k] = y[n] cos

N
N
n=0

( ) ( )

.
= x[r] g[n r ]cos(
+ sin(
)
)

N 1

N 1

r=0

n=0

2 nk
N

2 nk
N

From the results of Problem 5.87 we have:

N 1
2 k
2 k

YDHT [k] = x[]GDHT [k]cos


+ GDHT [k N ]sin

N
N
=0

= GDHT
1

( )
[k] x[] cos(
)+G
N 1
=0

2 k
N

( )

N 1
2 k
DHT [k N ] x[] sin N
=0

( )

= GDHT [k] ( X DHT [k] + X DHT [k N ])


2
1

+ GDHT [k N ] ( X DHT [k] X DHT [k N ])


2

= X DHT [k] (GDHT [k] + GDHT [k N ])


2

5.90

+ X DHT [k N ] (GDHT [k] GDHT [k N ])..


2

N 1

(a) We start with: y[n] = (1W Nnk + 2W Nnk )X DCFT [k]


k=0

N 1

N 1

= x[m] (11W N(mn)k + 2 2W N(m+n)k + 1 2W N(m+n)k + 1 2W N(mn)k )


m=0 k=0
N 1

= x[m]N(11 + 2 2 )[m n] + ( 21 + 1 2 )([m + n] + [m + n N])


m=0

= N(11 + 2 2 )x[n] + N( 21 + 1 2 )( x[n][n] + x[N n](1 [n]).

If we require: y[n] = x[n], 0 n N 1, then the following conditions must be


satisfied:

and

21 + 1 2 = 0,

(5-90-1)

N(11 + 2 2 ) = 1.

(5-90-2)

(b) Let 12 22 0. Solving for 1 and 2 in Eqns. (5-90-1) and (5-90-2) from above
we arrive at

1
2
,

=
.
1 = 2
2
N(1 22 )
N(12 22 )

Not for sale.

23

Then, the inverse DCFT is given by


N 1
1
x[n] =
(1W Nnk 2W Nnk )X DCFT [k], 0 n N 1.
2
2
N(1 2 ) k=0
(c) If 1 = *2 = re + j im with re 0 and im 0, the expression for X DCFT [k]
reduces
to:
N 1
2 nk
2 nk
X DCFT[k] = 2re cos
+ 2 im sin
x[n]

N
N
n=0

( )

( )

which is real. The inverse DCFT is then given by:

x[n] =

N 1
1
2 nk
2 nk
X
+ 2 re sin
[k].
2 im cos
N
N DCFT
4N1 2 k=0

( )

( )

(d) It can be easily shown that the discrete Hartley transform (DHT) of Eq. (5.192) is a
1

special
case of the real DCFT with re = im = 2N .
5.91

For the Hadamard Transform:

1 1
H 2 =
, H 4
1 1

(a)

1
1

1
H8 =
1
1

1
1

1
1
1
1
1
1
1
1

1
1
1
1
1
1
1
1

1
=
1

1
1
1
1
1
1
1
1
1

1
1
1
1
1
1
1
1
1
1
1
1

1
1
1
1
1
1
1
1
1
1
1
1

1
,
1

1
1 1

1 1
1 1

1 1
.
1 1
1 1

1 1
1 1

(b) From the structure of H 2 , H 4 , and H8 , it can be seen that:

H
H 4
H 2
H 4 = 2
, and H8 =
H 2 H
H 4

H 4
.
H 4

(c) Given that XHT = H N x. Therefore:

Not for sale.

24

T
*
x = H1
N X HT = N H N X HT = N H N X HT .
1

N 1

bi (n)bi (k)

Hence: x[n] = XHT [k](1) i=0


k=0

where bi (r) is the i th bit in the binary representation of r.

M5.1 For each of the problems, code and results are shown below:
(a)

N = input('The value of N = ');


k = -N:N;
y = ones(1,2*N+1);
w = 0:2*pi/255:2*pi;
Y = freqz(y, 1, w);
Ydft = fft(y);
n = 0:1:2*N;
plot(w/pi,abs(Y),n*2/(2*N+1),abs(Ydft),'o');
xlabel('\omega/\pi'),ylabel('Amplitude');

(b)

N = input('The value of N = ');


k = 0:N;
y = ones(1,N+1);
w = 0:2*pi/255:2*pi;
Y = freqz(y, 1, w);
Ydft = fft(y);
n = 0:N;
plot(w/pi,abs(Y),n*2/(N+1),abs(Ydft),'o');
xlabel('\omega/\pi'),ylabel('Amplitude');

(c)

N = input('The value of N = ');


k = -N:N;
y = ones(1,2*N+1);
y = y abs(k)/N;
w = 0:2*pi/255:2*pi;
Y = freqz(y, 1, w);
Ydft = fft(y);
n = 0:1:2*N;
plot(w/pi,abs(Y),n*2/(2*N+1),abs(Ydft),'o');
xlabel('\omega/\pi'),ylabel('Amplitude');

(d)

N = input('The value of N = ');


k = -N:N;
y = N + ones(1,2*N+1) abs(k);
w = 0:2*pi/255:2*pi;
Y = freqz(y, 1, w);
Ydft = fft(y);
Not for sale.

25

n = 0:1:2*N;
plot(w/pi,abs(Y),n*2/(2*N+1),abs(Ydft),'o');
xlabel('\omega/\pi'),ylabel('Amplitude');
(e)

N = input('The value of N = ');


k = -N:N;
y = cos(pi*k/(2*N));
w = 0:2*pi/255:2*pi;
Y = freqz(y, 1, w);
Ydft = fft(y);
n = 0:1:2*N;
plot(w/pi,abs(Y),n*2/(2*N+1),abs(Ydft),'o');
xlabel('\omega/\pi'),ylabel('Amplitude');

The plots generated for N = 4 are shown below where the circles denote the DFT
samples.
(a)

(c)

(b)

(d)

(e)

Not for sale.

26

M5.2 The code fragments to be used are as follows:


Y = fft(g).*fft(h);
y = iift(Y);
(a)

6 h[n]. The output generated using the above code fragments is


y[n] = g[n] O

y = -18

(b)

-14

19

22

5 v[n]. The output generated using the above code fragments is


w[n] = x[n] O

w = -15+18i -15-23i

(c)

4+7i

29-3i

5+13i

5 y[n]. The output generated using the above code fragments is


u[n] = x[n] O

u = -23

-69

35

105

73

M5.3 The properties are verified as follows:


N = 8; % sequence length
gamma = 0.5;
k = 0:N-1;
x = exp(-gamma*k);
X = fft(x);
% Property 1
X1 = fft(conj(x));
G1 = conj([X(1) X(N:-1:2)]);
% Verify X1 = G1
% Property 2
x2 = conj([x(1) x(N:-1:2)]);
X2 = fft(x2);

Not for sale.

27

% Verify X2 = conj(X)
% Property 3
x3 = real(x);
X3 = fft(x3);
G3 = 0.5*(X+conj([X(1) X(N:-1:2)]));
% Verify X3 = G3
% Property 4
x4 = j*imag(x);
X4 = fft(x4);
G4 = 0.5*(X-conj([X(1) X(N:-1:2)]));
% Verify X4 = G4
% Property 5
x5 = 0.5*(x+conj([x(1) x(N:-1:2)]));
X5 = fft(x5);
% Verify X5 = real(X)
% Property 6
x6 = 0.5*(x-conj([x(1) x(N:-1:2)]));
X6 = fft(x6);
% Verify X6 = j*imag(X)
M5.4 The properties are verified as follows:
N = 8;
k = 0:N-1;
gamma = 0.5;
x = exp(-gamma*k);
X = fft(x);
% Property 1
xpe = 0.5*(x+[x(1) x(N:-1:2)]);
xpo = 0.5*(x-[x(1) x(N:-1:2)]);
Xpe = fft(xpe);
Xpo = fft(xpo);
% Verify Xpe = real(X) and Xpo = j*imag(X)
% Property 2
X2 = [X(1) X(N:-1:2)];
% Verify X = conj(X2);
% real(X) = real(X2) and imag(X) = -imag(X2)
% abs(X)= abs(X2) and angle(X) = -angle(X2)
M5.5 The properties are verified as follows:
N = 8; % N is length of the sequence(s)

Not for sale.

28

gamma = 0.5;
k = 0:N-1;
g = exp(-gamma*k); h = cos(pi*k/N);
G = fft(g); H=fft(h);
% Property 1
alpha=0.5; beta=0.25;
x1 = alpha*g+beta*h;
X1 = fft(x1);
% Verify X1=alpha*G+beta*H
% Property 2
n0 = N/2; % n0 is the amount of shift
x2 = [g(n0+1:N) g(1:n0)];
X2 = fft(x2);
% Verify X2(k)= exp(-j*k*n0)G(k)
% Property 3
k0 = N/2;
x3 = exp(-j*2*pi*k0*k/N).*g;
X3 = fft(x3);
G3 = [G(k0+1:N) G(1:k0)];
% Verify X3=G3
% Property 4
x4 = G;
X4 = fft(G);
G4 = N*[g(1) g(8:-1:2)]; % This forms N*(g mod(-k))
% Verify X4 = G4;
% Property 5
% To calculate circular convolution between
% g and h use eqn (3.67)
h1 = [h(1) h(N:-1:2)];
T = toeplitz(h',h1);
x5 = T*g';
X5 = fft(x5');
% Verify X5 = G.*H
% Property 6
x6 = g.*h;
X6 = fft(x6);
H1 = [H(1) H(N:-1:2)];
T = toeplitz(H.', H1); % .' is the nonconjugate transpose
G6 = (1/N)*T*G.';
% Verify G6 = X6.'
M5.6 The program is shown below:

Not for sale.

29

y = x + j*h;
Yk = fft(y, length(y));
Xk = (1/2)*(Yk + conj([Yk(1) fliplr(Yk(2:end))]))
Hk = (1/(2j))*(Yk - conj([Yk(1) fliplr(Yk(2:end))]))
The result of the computation is:
(a) Xk = 0 2.5-2.5981i
2.5+2.5981i
Hk = 11 4.5+7.7942i
4.5-7.7942i
(b) Xk = 9 -1+8.6603i
-1-8.6603i

-13.5+2.5981i

-13.5-2.5981i

-8.5+4.3301i

-8.5-4.3301i

12+3.4641i

Hk = 6 0.5+0.8660i
0.5-0.8660i

-1

4.5+12.9904i

12-3.4641i
8

4.5-12.9904i

M5.7 The code for this operation is shown below:


x
N
n
y

=
=
=
=

[<insert the x sequence here>];


length(x)/2;
[0:N-1];
zeros(1,N);

for iter = 0:N-1


y(iter+1) = x(2*iter + 1)+1i*x((2*iter)+2);
end
Y
G
H
X

=
=
=
=

fft(y,N)
(1/2)*(Y + conj([Y(1) fliplr(Y(2:end))]))
(1/(2*j))*(Y - conj([Y(1) fliplr(Y(2:end))]))
[G G] + exp((-j*2*pi*[0:2*N-1])/(2*N)).*[H H]

The result of the computation is:


(a) X = 11
3.5622+5.0981i
7+5.1962i
-10-i
-22+6.9282i -8.5622-0.0981i
13
-8.5622+0.0981i
-22-6.9282i -10+i
7-5.1962i
3.5622-5.0981i
(b) X = 15 -3.1340-2.0359i -0.5+9.5263i 11+4.0000i
16.5+16.4545i -4.8660-8.9641i 7 -4.8660+8.9641i
16.5-16.4545i 11-4i -0.5-9.5263i -3.1340+2.0359i
M5.8 The code is provided below:

Not for sale.

30

x = [6.29 8.11 -7.46 8.26 2.64 -8.04 -4.43 0.93 -9.15


9.29];
XF = fft(x);
k =0:9;
YF = exp(-i*2*pi*k/5).*XF;
output = [XF(1) XF(6) sum(XF) sum(YF)];
disp(output)
disp(sum(abs(XF).*abs(XF)))
The output data generated by this program is:
6.4400

-30.6600

62.9000

62.9000

4913.4

M5.9 For code is provided below:


X = [12 -18-21j -10+4j -6+7j 9+8j 19-16j 39
19+16j 9-8j -6-7j -10-4j -18+21j];
x = ifft(X);
n = 0:11;
y = exp((i*2*pi/3).*n).*x;
output = [x(1) x(7) sum(x) sum(y) sum(x.*x)];
disp(output)
The output data generated by this program is:
3.2500

4.9167

12.0000

12.0000

426.7500

M5.10 The code and verification plots are shown below:


n=0:255;
x = 0.1*n.*exp(-0.03*n);
plot(n,x);axis([0 255 0 1.3]);
xlabel('n');ylabel('Amplitude');
title('Original signal');
pause
z = [zeros(1,50) ones(1,156) zeros(1,50)];
y = 4*rand(1,256)-1;
YF = z.*fft(y);
yinv = ifft(YF);
s = x + yinv;
plot(n,s);axis([0 255 -2 4]);
xlabel('n');ylabel('Amplitude');
title('Noise corrupted signal');
pause
zc = [ones(1,50) zeros(1,156) ones(1,50)];
SF = zc.*fft(s);
xr = ifft(SF);
plot(n,xr);axis([0 255 0 1.3]);
Not for sale.

31

xlabel('n');ylabel('Amplitude');
title('Signal after Fourier-domain filtering');

M5.11 The code for the overlap save method is provided below:
function y = overlapsave(x,h)
X = length(x);
%Length of longer sequence
M = length(h);
%length of shorter sequence
flops(0);
if (M > X)
%Error condition
disp('error');
end
%clear all
temp = ceil(log2(M)); %Find length of circular
convolution
N = 2^temp;
%zero padding the shorter
sequence
if(N > M)
for i = M+1:N
h(i) = 0;
end
end
m = ceil((-N/(N-M+1)));
while (m*(N-M+1) <= X)
if(((N+m*(N-M+1)) <= X)&((m*(N-M+1)) > 0))
for n = 1:N
Not for sale.

32

x1(n) = x(n+m*(N-M+1));
end
end
if(((m*(N-M+1))<=0)&((N+m*(N-M+1))>=0))
%underflow adjustment
for n = 1:N
x1(n) = 0;
end
for n = m*(N-M+1):N+m*(N-M+1)
if(n > 0)
x1(n-m*(N-M+1)) = x(n);
end
end
end
if((N+m*(N-M+1)) > X) %overflow adjustment
for n = 1:N
x1(n) = 0;
end
for n = 1:(X-m*(N-M+1))
x1(n) =x (m*(N-M+1)+n);
end
end
w1 = circonv1(h,x1); %circular convolution using
DFT
for i = 1:M-1
y1(i) = 0;
end
for i = M:N
y1(i) = w1(i);
end
for j = M:N
if((j+m*(N-M+1)) < (X+M))
if((j+m*(N-M+1)) > 0)
yO(j+m*(N-M+1)) = y1(j);
end
end
end
m = m+1;
end
%disp('Convolution using Overlap Save:');
y = real(yO);
function y = circonv1(x1,x2)
L1 = length(x1); L2 = length(x2);
if L1 ~= L2,
error('Sequences of unequal lengths'),
end

Not for sale.

33

X1 = fft(x1);
X2 = fft(x2);
X_RES = X1.*X2;
y = ifft(X_RES);
The MATLAB program for performing convolution using the overlap-save method is:
h = [1 1 1]/3;
R = 50;
d = rand(1,R) - 0.5;
m = 0:1:R-1;
s = 2*m.*(0.9.^m);
x = s + d;
%x = [x x x x x x x];
y = overlapsave(x,h);
k = 0:R-1;
plot(k,x,'r-',k,y(1:R),'b--');
xlabel('Time index n');ylabel('Amplitude');
legend('r-', 's[n]','b--','y[n]');
The output plot generated by the above program is shown below:

Not for sale.

34

Вам также может понравиться