Professional Documents
Culture Documents
Chapter 02
Dec 2011
6a/12/10 . x [n] = { 1, 2, 3, 4} and h [n] = {1, -1]}
Find linear convolution using circular convolution
June 2011
1. Find the DFT of the image
0121
1232
2343
1232
x4(3)
x1(2)
x2(2)
x2(0)
2
x1(0)
x2(1)
x1(3)
1
4
Preliminary concepts
Complex numbers:
C=R+jI
C is complex number
R and I are real numbers
j is an imaginary number j = -1 or (j2 = -1)
R denotes real part and I imaginary part
Real numbers are subsets of complex numbers
where I is 0
Conjugate of complex number C * = R J I
(Definition)
Thus C = |C| e j
1 + j2
is 3 e j
series:
Fourier series
Transform:
Important characteristics:
- A function can be expressed in either in
Fourier series or
Fourier Transform
The function can be reconstructed (recovered) completely
via an inverse process, with no loss of information
Fourier transformations allows us to work in the Fourier domain
and then return to the original domain
without loosing any information
The function at the bottom is the sum of the four functions above
urier series
A function f (t) of a continuous variable t
that is periodic with period T,
can be expressed as the sum of sines and cosines
multiplied by appropriate coefficients.
f (t)
f (t) = c n e
n=-
T/2
where c n = 1/T
+ j . 2 n / T
- T/2
.t
- j . 2 n/ T
f (t) e
for n = 0, 1, 2, . . .
. dt
12
F (u) = f (x) e
. dx
where j =-1
-
f (x) = F (u) e
.du
-
13
(R real I imaginary)
angle
I(u)
F (u) = tan-1
R ( u)
The plot of |F (u)| is called the magnitude plot or the Fourier spectrum
Power spectrum can also be plotted:
Power P (u) = | F (u) | 2 = [R2 (u) + I2(u)]
14
F (u) =
-
Time
-j 2 u x
f (x) e
x
-j 2 u t
= Ae
.dt
0
A
x
-j 2 u t
= ----------- [e
- j2 u
]
0
A
-j 2 u x
= ---------- [ 1 - e
j2 u
.dx
-A
= ------- [e
j2 u
-j 2 u x
- 1]
]
15
A
= ---------
[e
+j u x
-j u x
-e
] e
21
-j u x
j 2 u
A
e = ----------u
+j u x
e
-----------------2j
+j u x
-j u x
.e
-j u x
A
= -------- . [ sin ( u x ) . e
u
sin ( u x )
F (u) = A ---------------u
]
-j u x
.[e
16
F (u) = A
sin ( u x )
---------------u
-j u x
.[e
17
]|
sin 0
At u = 0 ;
|F (u)| = Ax -------0
But sin x
is indeterminate
x
In such a case L Hospitals rule is used,
Derivative of the numerator and the denominator is taken
with its limit tending to 0
d/dx sin x
Lim
x0
dx/dx
= lim cos x /1 = 1
x0
Thus |F (u)| = A . X .1 = A . x at u =0
f (x, y) e.
dx dy
-
-
+j2 (u x + v y)
Inverse Fourier Transform of F (u, v)
F-1 { F (u, v)} = f (x, y) =
F (u, v) e
- -
du dv
x
x
Magnitude
sin( u x)
F (u, v) = A . x. y
ux
sin( v y)
.
vy
20
F (u, v) =
-
x
=
=
A
e
=A
f (x, y) e
y
A
0
j2 (u x + v y)
j2 (u x + v y)
dx dy
x j2 u x
e
dx
0
j2 u
x e
---------------j2 u
y
j2 v y
e
dy
0
x
j2 v y
---------------j2 v
j2 u
1 -e
x
1 -e
=A
-------------j2 u
e
=A
+j u x
dx dy
j u x
-e
-----------------------j2 u
j2 v y
-------------------j2 v
e
j u x
e
+j v y
j v y
-e
-------------------21
j2 v
j v y
F (u, v ) = A. x. y
sin( u x)
ux
e j u x
sin( v y)
vy
e j v y .
sin( u x)
F (u, v) = A. x. y
ux
sin( v y)
.
vy
22
23
24
-j2ux/N
for u = 0. 1, 2 . . . N-1
F (u) e
+j2ux/N
; for x = 0, 1, 2 . . . , N-1
26
M-1
N-1
- j 2 (u x /M
F (u, v ) =
f (x, y) e
x=0 y=0
+ v y /N)
u = 0 v=0
+ j 2 (u x /M + v y /N)
F (u, v) e
27
DFT
N-1
F (u ) = f (x) e -j2 (u x / N)
x=0
; for u = 0, 1, 2 . . . N-1
Here N = 4
4-1
so F (u ) = f (x) e -j2 (u x / 4) : for u = 0. 1, 2 . . (4 -1 = 3)
x=0
-j2 (u x / 4 )
3
Fourier Transform: F (u) = f (x) e
for u = 0 to 3
x=0
For u = 0 and x = 0 to 3
F(0) = [ f (0) e -j2 (0 . 0 / 4) + f (1) e -j2 (0 . 1 / 4) + f (2) e -j2 (0 . 2 / 4)
+ f (3) e -j2 (0
= [0. 1
. 3/ 4)
]
+1.1
+2.1
+ 1 . 1] = 4
28
For u = 1 and x = 0 to 3
. 1 / 4)
+ f (2) e -j2 (1
. 2 / 4)
+ 1. e -j / 2 + 2. e -j + 1. e -j 3/2 ]
-j
+ 2 ( -1 j . 0)
+ 1. ( 0
- j . -1)]
+ j ] = -2
29
Sin 0
= 0 cos 0 = 1
Sin /2 = 1 cos /2=0
Sin
= 0 cos = -1
Sin 3 /2 = -1 cos 3 /2 =0
e -j = sin - j cos
e -j 0 = sin 0 - j cos 0
e -j /2 = sin /2 - j cos /2
e -j = sin - j cos
(0 )
=1-0 = 1
(90 ) = 0 -j = - j
(180 ) = -1 0 = -1
(270 ) = 0 +j = + j
e +j = sin + j cos
e +j 0 = sin 0 + j cos 0
(0 )
= 1 +0 = 1
e +j /2 = sin /2 + j cos /2 (90 ) = 0 +j = + j
e +j = sin + j cos
(180 ) = -1 0= -1
e +j 3/2 = sin 3/2 - j cos 3/2
(270 ) = 0 -j
=-j
30
For u = 2 and x = 0 to 3
+ f (1) e -j
+ f (2) e -j 2
+ f (3) e -j 3 ]
31
For u = 3 and x = 0 to 3
+ f (1) e j6 / 4+ f (2) e -j 3
+ f (3) e -j 9 / 4 ]
Mag |F(u)|
F(u)
4
4
2
0
0 1 2 3
-2
-2
0
1 2 3
u
32
Twiddle Factor:
Let us define a new factor, WN, called Twiddle factor
j 2 / N
WN = e
or
j 2. n k / N
W Nn k = e
Thus
N-1
DFT X (k) = x (n) WNn k
n =0
- To solve the above equation , let us form a matrix WN = N . N matrix
33
Thus DFT equation reduces to
=1
j2 .0.0/ 4
n =1, k =1 W41.1 = e j2 . 1. 1 / 4 = -j
n =2, k =1 W42.1 = e j2 . 2. 1 / 4 = -1
n =3, k =1 W43.1 = e j2 . 3. 1 / 4 = j
n =2, k =2 W42.2 = e j2 . 2. 2 / 4 = 1
n =3, k =2 W43.2= e j2 . 3. 2 / 4 = -1
n =3, k =3
W43.3= e j2 . 3. 3 / 4 = -j
2 3
W 4 nk
(n) 0
1
(k)
0
W40.0 W41.0 W42.0 W43.0
W4 =
2
1
=
1
-j
-1
-1
-1
DFT 34
matrix
for N =4
for N =4, for nk = 0
=1
= -j
= -1
=j
=1
= -1
35
= -j
X (k) = W4 . x (n)
X (0)
X (1)
X (2)
X (3)
X (0)
X (1)
X (2)
X (3)
1
=
1
1
1 1 1
1 -j -1
-1 1 -1
j -1 -j
1 1 1
=
1 -j -1
1 -1 1 -1
1 j -1 -j
x (n) = { 0, 1, 2, 1}
x (0)
j x x (1)
x (2)
x (3)
0
x
j
2
36
k=0
X (k) e
N-1
x (n) = 1/N
k=0
X (k) WN n k
+j 2 n k / N
(W * Complex conjugate of W)
37
x =.
W 4*
1 1 1 1
4
x (n) = 1 j -1 -j x -2
1 -1 1 -1
0
1 -j -1 j
-2
0
8
4
0
= 4
2
1
x (n) = { 0, 1, 2, 1}
A* Complex conjugate is obtained from A by taking the
38
N-1
DFT
X (k) =
x (n) e j
n =0
2 n k / N
N-1
DFT X (k) = x (n) WNn k
n =0
Matrix form: X = W. x
X(0)
X(1)
X(2)
X(3)
1 1
1 -j
1 -1
1 j
1 1
-1 j
1 -1
-1 -j
11
x 21
3
4
(WN nk = e j 2 / N
nk
39
N-1
IDFT x (n) = 1/N
X (k) e +j 2 nk / N
k=0
N-1
Matrix x = 1/N [W * X]
and N =4
x (0)
x (1) = 1/N
x (2)
x (2)
1 1 1 1
1 j -1 -j
1 -1 1 -1
1 -j -1 j
39
8 17j
-11
8 + 17j
40
That means:
31
|X((k)|
7
9.84
9.84
5.58
5.58
1.68
0
1.68
2
DFT Properties:
1.
2.
3.
4.
5.
6.
7.
8.
Linearity
Periodicity
Circular time shift property
Circular frequency shift
Complex conjugate property
Circular convolution
Multiplication of two sequences
Time reversal
Linearity:
If x1 (n)
DFT
X1 (k)
x2 (n)
DFT
X2 (k) then
a. x1(n) + b. x2(n)
DFT
and
a. X1 (k) + b. X2 (k)
42
Periodicity
If
x (n)
DFT
X (k)
then
DFT X (k + N )
= DFT
X (k)
The DFT is periodic with a period N
Circular shift of a sequence:
A periodic extension of a sequence x (n) can be written as:
x p (n) =
x (n - l . N)
Where N is the period
l=-
xp (n) = x ( (n) )N is the periodic extension of x (n)
here ( (n) )N denotes,
n modulo N
x (n) = x ( (n) )
p
x (n)
1 2
0 1 2 3
1
n
4
1 2
4
1
-4 -3 -2 -1 0 1 2 3 4 5 6 7
43
x(n) 1 x(0)
4
x(3)
44
x (n) = { 1, 2, 3, 4, 1, 2 . . )
1 2
4
1
3
1
-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
x (2) 1
x (1)
4
x(n)
3 x (0)
2
x 3)
( (n) )N denotes n modulo N
x ( -3 modulo 4 ) = x( (-3) )4 = x (1)
x ( 11 modulo 4 ) = x( (11) )8 = x (3)
45
Shift in x (n) x (n m)
x (n) DFT
X (k)
Then x ( (n m ) )N
j2 k m / N
DFT e
. X ( k)
x (n) DFT
x (n) e
Shift in frequency
X (k)
j2mn /N
DFT of { x (n) . e j 2 m n
DFT
/N
X ( (k m ) ) N
} is X ((k m )N
X ( k m )N is frequency shift
46
x (n)
Then
DFT
x * (n)
X (k)
DFT X * (N - k) = X * ( (-k) )N
* Complex conjugate
6. Circular Convolution :
If x1(n)
DFT
X1(k)
x2(n)
DFT
DFT ( x1(n)
X2(k)
*
x2(n) )
and
then
X1(k) . X2(k)
+
Linear convolution y (n) = x (k) h (n - k)
k=-
Where x (n) is input signal
h (n) is impulse response
both non periodic
For periodic signals, the above formula cannot be used
It needs some changes
Let x1 (n) and x2 (n) be periodic signals
Let
DFT of x1(n) = X1(k)
DFT of x2(n) = X2 (k)
If X3 (k) = X1(k) . X2 (k) then
the IDFT of [X3 (k) )= x3 (n) will be
N-1
x3 (n) = x1 (m) . x2 (n - m)
m=0
Since x1, x2, and x3 are periodic with period N
N-1
x3 ((n))N =
x1 ((m))N . x2 ((n m))N
48
m=0
N-1
x3 (n) =
x3 (n) = x1 (n )
x2 (n)
x2 (n) ] = X1 (k ) . X2 (k)
49
x1(n)
DFT
X1 (k)
and
x2(n)
DFT
X2 (k)
then
x1(n). x2(n)
DFT
1/N [ X1 (k)
X2(k) ]
Circular convolution
9. Time Reversal
if
x (n) is periodic
Then
if
x ( (-n) )N
x (n )
= x (N-n)
for 0 n N-1
input signal
DFT X (k )
x (N - n )
DFT X (N - k )
x ( ( n ) )N DFT X ( N k )
or
50
Circular Convolution
Given two periodic signals x1 (n) and x2 (n)
Find circular convolution
y (n) = x1 (n) x2 (n )
(circular convolution)
Two methods:
1. Concentric circle method
2. Matrix multiplication method
51
x2 (n)
2. Plot x2(n) evenly spaced along the inner circle in clockwise direction,
such that x1(0) matches x2(0)
52
x (1)
1
x4(3)
x1(2)
x2(2)
x2(0)
2
x1(0)
x2(1)
x1(3)
1
4
53
Matrix method
In this method circular matrix of x2 (n) is generated
it is multiplied by x1 (n )
y (0)
x2 (0)
x2 (N-1)
y (1)
x2 (1)
x2 (0)
y (2)
= x2 (2)
.
.
.
x2 (N-1)
x2 (1)
.
.
.
y (N-1)
x2 (N-2)
x2 (N-1)
x2 (0)
.
.
.
.
.
.
.
x2 (N-2)
. . . X2 (1)
x1 (0)
. . . X2 (2)
.. .
X2 (3)
.
.
.
. . . X2 (0)
54
and
x1 (1)
.
x1 (2)
.
.
.
x1 (N-1)
Matrix method:
In this a circular matrix of x2(n) is generated
and multiplied by x1(n)
x1(n) = { 1, 2, 3, 4}
y (n) = x1 (n)
x2 (n)
x2(n)
y (0)
4 2
y (1) =
1 4
y (2)
1 1
y (3)
2 1
x1(n)
x
1 1
2 1
4 2
1 4
and
1
2
3
4
x2(n) = { 4, 1, 1, 2}
4 + 4 + 3 +4 = 15
= 1+ 8 + 6 +4 = 19
1 + 2 + 12 +8 = 23
2 + 2 + 3 +16 = 23
55
Use the four point DFT and IDFT to determine the circular convolution
of the sequences
x1 (n) = { 1, 2, 3, 1}
x2 (n) = { 4, 3, 2, 2}
WN
X1 (0)
1 1 1 1 1
X2 (1)
1 -j -1
X1 (2)
X1 (3)
x1
j 2
.
1 -1 1 -1 3
1 j -1 -j 1
Therefore
Similarly
X1 (k) = { 7, -2 -j,
1,
5 , 1,
-2 +j }
2 +j }
-5 }
56
DFT of x (n)
Matrix X = W N nk . x
X (0)
X (1)
X (2)
X (3)
1 1 1 1 1
=
1 -j -1 j
1 -1 1 -1 3
1 j 1 -j 4
Therefore
Now x (n ) = { 4, 3, 2, 1} since
it is periodic = { 4, 3, 2, 1, 4, 3, 2 } = { 1, 4, 3, 2 }
it is = x1 (n)
x ( n )
DFT
X (-k ) = { 10,
57
END
58
59
f (x, y) e
FT
F (u - u0, v - v0 )
60
|F (u)| = |F (u + N)|
61
62
f (x, y) e
;
x=0 y=0
Where M, N is the number of samples of
the input 2-D signal
This can split up as :
M-1
N-1
- j 2 (ux /M)
F (u, v ) =
e
.
f (x, y) e
x=0
y=0
N-1
- j 2 (vy /N)
Let F (x, v ) =
f (x, y) e
y=0
- j 2 (ux /M)
M-1
Therefore F (u, v ) =
F (x, v) e
x=0
63
- j 2 (vy /N)
N-1
F (x, v ) =
f (x, y) e -j2 v y/N
y=0
For each value of x and for v = 0, 1, 2, . . , N-1
F (x, v) is simply 1-D DFT of a row of
f (x, y)
M-1
In F (u, v ) =
x=0
F (x, v) e - j 2 u x / M
f (x, y)
(0,0)
N-1
y
f (x, y
Row
transformation
(0,0)
v
F (x, v)
(0,0)
y
F (u,v)
Column
transformation
x
65
Partial result
4 -2 0 -2
8 -2 0 -2
12 -2 0 -2
8 -2 0 -2
DFT of 1st column=W4 . 4
8 -8
12 0
8 -8
32
-8
+
Linear convolution y (n) = x (k) h (n - k)
k=-
Where x (n) is input signal
h (n) is impulse response
both non periodic
For periodic signals, the above formula cannot be used
It needs some changes
Let x1 (n) and x2 (n) be periodic signals
Let
DFT of x1(n) = X1(k)
DFT of x2(n) = X2 (k)
If X3 (k) = X1(k) . X2 (k) then
the IDFT of [X3 (k) ]= x3 (n) will be
N-1
x3 (n) =
x1 (m) . x2 (n - m)
m=0
Since x1, x2, and x3 are periodic with period N
N-1
x3 ((n))N =
x1 ((m))N . x2 ((n m))N
68
m=0
N-1
x3 (n) =
x3 (n) = x1 (n )
x2 (n)
x2 (n) ] = X1 (k ) . X2 (k)
y (0)
x2 (0)
x2 (N-1)
y (1)
x2 (1)
x2 (0)
y (2)
= x2 (2)
.
.
.
x2 (N-1)
x2 (1)
.
.
.
y (N-1)
x2 (N-2)
x2 (N-1)
x2 (0)
.
.
.
.
.
.
.
x2 (N-2)
. . . X2 (1)
x1 (0)
. . . X2 (2)
.. .
X2 (3)
.
.
.
. . . X2 (0)
70
and
x1 (1)
.
x1 (2)
.
.
.
x1 (N-1)
x (n) = { 1, 2, 3, 4, 0, 0}
h (n) = { 1, -1, 0, 0, 0, 0}
Y (n)
Y (0)
Y (1)
Y (2)
Y (3)
Y (4)
Y (5)
1
-1
0
0
0
0
0
1
-1
0
0
0
0 0 0
0 0 0
1 0 0
-1 1 0
0 -1 1
0 0 -1
-1
0
0 .
0
0
1
x (n)
1
2
3
4
0
0
1
1
=
1
-4
0
Y = { 1, 1, 1, 1, -4, 0}
71
72