0% found this document useful (0 votes)
122 views134 pages

DFT and FFT - 2021

The document discusses the discrete Fourier transform (DFT). It begins by explaining that while time domain representation describes a digital signal's amplitude over time, frequency domain representation in terms of frequency components is also useful. The DFT transforms a discrete signal from the time domain to the frequency domain. It allows a digital signal to be broken down into its constituent frequencies, showing the spectral content and how it is distributed over frequency. The DFT provides the frequency domain representation of a digital signal.

Uploaded by

Sourya Dasgupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views134 pages

DFT and FFT - 2021

The document discusses the discrete Fourier transform (DFT). It begins by explaining that while time domain representation describes a digital signal's amplitude over time, frequency domain representation in terms of frequency components is also useful. The DFT transforms a discrete signal from the time domain to the frequency domain. It allows a digital signal to be broken down into its constituent frequencies, showing the spectral content and how it is distributed over frequency. The DFT provides the frequency domain representation of a digital signal.

Uploaded by

Sourya Dasgupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 134

Discrete Fourier Transform

Prof. Anjan Rakshit and Prof. Amitava Chatterjee


Electrical Measurement and Instrumentation Laboratory,
Electrical Engineering Department,
Jadavpur University, Kolkata, India.
Discrete Fourier Transform
References

M. E. Van Valkenburg. Network Analysis. Prentice Hall.

J. G. Proakis and D. G. Manolakis. Digital Signal Processing: Principles,


Algorithms and Applications. Prentice Hall. Fourth Edition.

Johnny R. Johnson. Introduction to Digital Signal Processing. Prentice Hall.

Li Tan. Digital Signal Processing: Fundamentals and Applications.


Academic Press.
Discrete Fourier Transform

In time domain or sequence domain, representation of digital signals describes


the signal amplitude versus the sampling time instant or the sample number.

However, in some applications, signal frequency content is more useful than the
digital signal samples.

Hence representation of the digital signal in terms of its frequency


components in frequency domain, i.e. the signal spectrum, needs to be
developed.
Discrete Fourier Transform

Time domain representation


xk
of a 1,000-Hz sinusoid with
32 samples at a sampling
rate of 8,000 Hz

Sample number k

The corresponding signal


spectrum i.e. the frequency
domain representation

Conclusion: The spectral plot better displays frequency information of a


digital signal.
Fourier series for a periodic signal

Let x(t) be a periodic function of time having a time period T0, then
the fundamental frequency of x(t) is

2
0  …….(1)
T0
Fourier series for a periodic signal

Let x(t) be a periodic function of time having a time period T0, then
the fundamental frequency of x(t) is

2
0  …….(1)
T0
The signal x(t) may be expressed in terms of the Fourier series as


x(t )  a0   an cos n0t  bn sin n0t  …….(2)
n1
Fourier series for a periodic signal

x(t )  a0   an cos n0t  bn sin n0t  …….(2)
n1

where 2 T0
1 1
a0   x(t)d (0 t)   x(t)dt , the average value
2 0 T0 0
2 T0
1 2
an   x(t) cosn0td(0 t)   x(t) cosn0tdt
 0 T0 0 for n = 1, 2, 3, …
2 T0
1 2
bn   x(t ) sin n0td (0 t )   x(t ) sin n0tdt
 0 T0 0 for n = 1, 2, 3, …

an’s are known as cosine coefficients and bn’s are known as sine coefficients.
Fourier series for a periodic signal
Relation (2) may be rewritten as


2 an 2  bn 
x(t)  a0   an  bn ( 2 2 cosn0t  2 2 sinn0t)
n1 an  bn an  bn

or x(t )  C0  Cn cos(n0t   n ) …….(3)
n1

cos(A  B)  cos AcosB  sin Asin B


2 2 1bn
where C0  a0 Cn  an bn n   tan n
-bn

an an

Cn, n = 1, 2, 3, … is the amplitude and n, n = 1, 2, 3, … is the phase


of the nth harmonic. C0 is the average value.
Fourier series for a periodic signal
Expressing cosine and sine terms of relation (2) in terms of their complex
exponential values as

 jn0t  jn0t jn0t  jn0t


e e e e
x(t )  a0  [an ( )  bn ( )]
n1 2 2j

jn 0t an  jbn  jn 0t a n  jbn
or x(t )  a0  [e ( )e ( )]
n 1 2 2

or x(t )  F0   [ Fn e jn 0t  Fn e  jn 0t ] …….(4)
n 1
an  jbn an  jbn
where F0  a0 , Fn  ( ) and Fn  ( )
2 2
Fourier series for a periodic signal

Now x(t )  F0   [ Fn e jn 0t  Fn e  jn 0t ] …….(4)
n 1

an  jbn an  jbn
where F0  a0 , Fn  ( ) and Fn  ( )
2 2

Here F n  Fˆn , conjugate of Fn.

Relation (4) may be expressed as

 
x(t )  F0   Fn e jn 0t   Fn e  jn 0t
n 1 n 1
Fourier series for a periodic signal
 
Now x (t )  F0   Fn e jn 0t   F n e  jn 0t
n 1 n 1
 
x (t )  F0   Fn e jn  0 t   n
F e jn  0 t

n 1 n  1


Hence, we can write, x (t )   F n e jn  0 t …….(5)
n  

Thus x(t) may be expressed in terms of Complex Fourier Series in


relation (5). Here Fn is known as the Complex Fourier coefficient.
Fourier series for a periodic signal
 
Now x (t )  F0   Fn e jn 0t   F n e  jn 0t
n 1 n 1
 
x (t )  F0   Fn e jn  0 t   n
F e jn  0 t

n 1 n  1


Hence, we can write, x (t )   F n e jn  0 t …….(5)
n  

F n  Fˆn

Variation of Fn coefficients with n


Fourier series for a periodic signal

F n  Fˆn

Variation of Fn coefficients with n


Fourier series for a periodic signal
The amplitudes Cn’s of relation (3) may be related to Fn’s as

C0  F0 , the average value


and C n  2 Fn , for n = 1, 2, 3, … …….(6)

the amplitude of the nth harmonic.

 j Fn  Fn  
1
and  n   tan  
 Fn  Fn  
the phase of the nth harmonic.
Fourier series for a periodic signal
From relation (4), Fn may be expressed as

an  jbn
Fn  ( )
2
Substituting expressions of an and bn from relation (2)

T0
1  jn  0 t
Fn   x ( t ) e dt …….(7)
T0 0

For aperiodic signals, the time period T0 becomes infinite, and the Fourier
transform of an aperiodic signal x(t) is defined as

 j t
X ( )   x ( t ) e dt …….(8)

Fourier series for a periodic discrete sequence

Let xk be a periodic discrete sequence obtained from a periodic signal x(t)


with a time period T0.
Let N number of samples be available in the time period T0 with a sampling
interval . The corresponding sampling frequency = fs Hz.

T0 = N and  = 1/fs …….(9)

Assumption: The periodic discrete sequence is band limited to have all


harmonic frequencies less than the folding frequency (fs/2) so that aliasing
does not occur.
Fourier series for a periodic discrete sequence

Using rectangular rule for integration, the Fourier coefficients may be obtained as

From relation (2)


T0
1
a0   x (t ) dt
T0 0

N 1
1
a0 
T0
x 
k 0
k

N 1 N 1
1 1
or a0 
N

k 0
x k  
N
x
k 0
k …….(10)
Fourier series for a periodic discrete sequence

Using rectangular rule for integration, the Fourier coefficients may be obtained as

Similarly,
From relation (2)
T0
2
an 
T0  x (t ) cos n tdt
0
0

N 1
2   2  
an 
N
  x k cos n N k 
k 0    
2 N 1  2 kn 
or an   x k cos   …….(11)
N k  0
 N 
2 2
(using the substitutions:  0   and T0  N and t  k in relation (2))
T0 N
Fourier series for a periodic discrete sequence

Using rectangular rule for integration, the Fourier coefficients may be obtained as

and
From relation (2)
T0
2
bn 
T0  x (t ) sin n  tdt
0
0

N 1
2   2  
bn 
N
  x k sin n  N   k 
k 0    
2 N 1  2 kn 
or bn   x k sin   …….(12)
N k  0
 N 
2 2
(using the substitutions:  0   and T0  N and t  k in relation (2))
T0 N
Fourier series for a periodic discrete sequence
Now from relations (11) and (12),

N 1
a n  jb n 1   2 kn   2 kn  

N
 x k  cos    j sin  
2 k 0   N   N 
N 1  2k 
1  jn 
 N 

  xk e
N k 0
Hence, the Fourier series coefficients for the periodic discrete sequence are:

F0  a0 and

N 1  2k 
an  jbn 1  jn 
 N 

Fn    xk e , n  1,2,3, …….(12a)
2 N k 0

Since the coefficients Fn are obtained from the Fourier series expansion in
the complex form, the resultant spectrum Fn will have two sides.
Fourier series for a periodic discrete sequence
Now from relations (11) and (12),

N 1
a n  jb n 1   2 kn   2 kn  

N
 x k  cos    j sin  
2 k 0   N   N 
N 1  2k 
1  jn 
 N 

  xk e
N k 0
Hence, the Fourier series coefficients for the periodic discrete sequence are:

F0  a0 and

N 1  2k 
an  jbn 1  jn 
 N 

Fn    xk e , n  1,2,3, …….(12a)
2 N k 0

It can be shown that Fn+N = Fn. Hence the Fourier series coefficients Fn are
periodic having a periodicity of N.
Fourier series for a periodic discrete sequence

Fn

Amplitude spectrum of a representative periodic signal

For the kth harmonic, the frequency is f=kf0. The frequency spacing between
the consecutive spectral lines, called the frequency resolution, is f0 Hz.
As Fn+N = Fn, the two-sided line amplitude spectrum Fn is periodic.
Fourier series for a periodic discrete sequence

Fn

OBSERVATIONS:

• Only the line spectral portion between the frequency –fs/2 and frequency
fs/2 (folding frequency) represents the frequency information of the
periodic signal.

• The spectral portion from fs/2 to fs is a copy of the spectrum in the


negative frequency range from –fs/2 to 0 Hz due to the spectrum being
periodic for every Nf0 Hz.
Fourier series for a periodic discrete sequence

Fn

OBSERVATIONS:

• For convenience, we compute the spectrum over the range from 0 to fs Hz


with nonnegative indices, i.e.,
N 1  2k 
1  jn 
 N 

Fn   xk e , n  0,1,2,3,, N  1 …….(12b)
N k 0
• If negative indexed spectral values are needed, those can be obtained
using the relation: Fn+N = Fn.
Fourier series for a periodic discrete sequence
Problem 1
Let us consider a periodic signal x(t) = sin(2t), sampled using a sampling rate of fs = 4 Hz.
(i) Compute the Fourier coefficients or spectrum Fn using the samples in one period.
(ii) Plot the two-sided amplitude spectrum Fn over the range from -2 to 2 Hz.
Solution
From the analog signal, we get fundamental frequency 0 = 2 rad/s.
Hence f0 = (0/2) = 1 Hz and fundamental time period T0 = 1 s.
Sampling interval  = 1/fs = 0.25 s.
Hence sampled signal = xk = x(k) = sin(2k) = sin(0.5k)

xk
x1

x0 x2 First eight samples of the


periodic digital signal

x3
Fourier series for a periodic discrete sequence
Problem 1
Let us consider a periodic signal x(t) = sin(2t), sampled using a sampling rate of fs = 4 Hz.
(i) Compute the Fourier coefficients or spectrum Fn using the samples in one period.
(ii) Plot the two-sided amplitude spectrum Fn over the range from -2 to 2 Hz.
Solution (contd.)
For a duration of one period, N = 4. The sample values are: x0=0, x1=1, x2=0, x3=-1.
From the expression of Fn in relation (12a), we can compute:

1 3 1 1
F0   xk   x0  x1  x2  x3   0  1  0  1  0
4 k 0 4 4

1 3  j 2 1k  1  j  j 3
F1   xk e 4
  x0  x1e 2  x2e  x3e 2 
  j
4 k 0 4 
1 1
  x0  jx1  x2  jx3   0  j1  0  j  1   j 0.5
4 4
Fourier series for a periodic discrete sequence
Problem 1
Let us consider a periodic signal x(t) = sin(2t), sampled using a sampling rate of fs = 4 Hz.
(i) Compute the Fourier coefficients or spectrum Fn using the samples in one period.
(ii) Plot the two-sided amplitude spectrum Fn over the range from -2 to 2 Hz.
Solution (contd.)
Similarly we get:

1 3  j 2 2 k  1 3  j 2 3k 
F2   xk e 4
0 and F3   xk e 4
 j 0.5
4 k 0 4 k 0
Using periodicity, it follows that:

F1  F3  j 0.5 and F2  F2  0


Fourier series for a periodic discrete sequence
Problem 1
Let us consider a periodic signal x(t) = sin(2t), sampled using a sampling rate of fs = 4 Hz.
(i) Compute the Fourier coefficients or spectrum Fn using the samples in one period.
(ii) Plot the two-sided amplitude spectrum Fn over the range from -2 to 2 Hz.
Solution (contd.)

Fn

Two sided amplitude


spectrum Fn for the
periodic digital signal
Fourier series for a periodic discrete sequence
Now, from relation (12a), we can write,

N 1  2k 
N  jn  
 a n  jbn    xk e  N 

2 k 0

N
Substituting Na0  X 0 and  an  jbn   X n , for n = 1,  2,  3, …
2

N 1  2k 
 jn 
 N 
X n  NFn   xk e for n = 0, 1, 2, … …….(13)
k 0
Fourier series for a periodic discrete sequence
N 1  2k 
 jn 
 N 
From relation (13) X n  NFn   xk e for n = 0, 1, 2, …
k 0

Now, let us consider n = N + m, for m = 0, 1, 2, …

 2k 
N 1  j  N  m  
 N 
X n   xk e
k 0

N 1  2k 
 jm 
or X mN  xk e j 2k  .e  N 

k 0

N 1  2k 
 jm 
 N 
or X mN  xk e  Xm …….(14)
k 0

Conclusion: Xn is periodic with a period N.


Fourier series for a periodic discrete sequence

Then, within one period (i.e. for n = 0, 1, 2, …, N-1),

N 1  2k 
 jn 
 N 
X n   xk e , for n = 0, 1, 2, …., N-1 …….(15)
k 0

Conclusion: Relation (15) is known as the Discrete Fourier Transform


(DFT) of a finite sequence xk, k = 0, 1, 2, …, N-1.

The Xn constitutes the DFT coefficients.


Fourier series for a periodic discrete sequence

Relation (14) represents the periodicity property of DFT.

Xn repeats at the Nth harmonic.

The frequency corresponding to the Nth harmonic is:

N N 1 , the sampling frequency.


Nf 0     fs
T0 N 

Conclusion: Xn repeats at the sampling frequency fs.


Discrete Fourier Transform

The Discrete Fourier Transform (DFT) of a finite sequence


xk, k = 0, 1, 2, …, N-1 is defined as

N 1  2k 
 jn 
 N 
X n   xk e , for n = 0, 1, 2, …., N-1 …….(15)
k 0

Amplitude Cn (c.f. relation (3)) is related to Xn as

1
C0  X 0 , the average value
N
2
and Cn  X n , for n = 1, 2, 3, … …….(16)
N
Discrete Fourier Transform

T0 = N
xk xN+1=x1
x1
The development of
the DFT formula
x0
k
xN=x0
xk
x1 xk Xn=NFn

x0 xN-1 t = k f = nf
k f = fs/N
Inverse Discrete Fourier Transform
Relation (15):
 2 l  N 1  2k 
 jn 
By multiplying 1 jn 
 N 

X n   xk e  N 
e , for n = 0, 1, 2, …., N-1
N k 0

on both sides of relation (15) and summing up from n = 0 to N-1 with 0  l  N

 2 l   2 k   2 l 
1 N 1 jn 
 N 
 1 N 1 N 1  jn 
 N 
 jn 
 N 

 X ne    xk e .e
N n 0 N n0 k 0
1 N 1 N 1 jn  l  k 
2

   xk e N

N n0 k 0
Now, changing the order of summation,

 2 l  2  l  k 
1 N 1 jn 
 N 
 1
N 1 N 1 jn 
N
X n e   xk  e N
 …….(17)
n 0 k 0 N n 0 
Inverse Discrete Fourier Transform
N 1 2 ( l  k )
jn
Now, in e
n 0
N , when (l  k )  pN
N 1
jn 2  p
where p is a positive integer, the expression becomes 
n0
e
N 1 N 1
j 2  np 
As np is another integer, it becomes
 e
n 0
 1  N
n 0

In the present case, as l and k are limited within 0 and (N – 1), the possible
value of p is zero, i.e. when (l - k) = 0 or l = k, the summation becomes N.
Inverse Discrete Fourier Transform
N 1 2 ( l  k )
jn
2 l  k 
Now, in e
n 0
N , let
N


N 1 2 l  k  N 1
jn
jn 
Then the summation becomes e
n 0
N =
 e
n0

It may be expressed as

N 1 N
jn j  m1
 
e
n0
 e
m1
, where m = n + 1

N
  e jm .e  j
m 1
Inverse Discrete Fourier Transform
N 1 N
jn jm  j
or  
e
n0
 .e
e
m1
N
 
 e  cos m  j sin m 
 j

m1 
 N N 
sin sin
 j  2  N 1  2  N  1 
e  cos  j sin  
  2    2 
 sin sin
 2 2 
 N 
sin N 1
 j 
j 
e  2 e 2
 
 sin 
 2 
Inverse Discrete Fourier Transform
 N 
N 1 sin N 1
 j 
j 
jn 2
or e e 

e 2

n0  sin 
 2 
N
sin j
N 1

 2 e 2

sin
2
 jN2  jN 

e  e 2 
  jN 
 
2j e 2
e jN  1
 j  j
. j  j
  2 e 1
e 2
e 2  e
 
 
2j
Inverse Discrete Fourier Transform
N 1
jn e jN  1
or e
n0
 j
e 1
Putting the value of ,

 l k  j 2 ( l k )
N 1 jn2 e 1
e
n0
N
 j 2
( l k )

e N
1
Now for l  k, the summation is zero.

And for l = k, it becomes indeterminate   form.


 0
 0
Inverse Discrete Fourier Transform
N 1 jn2
l k 
Thus,
e
n0
N
 N, for l  k

 0, for l  k
considering 0  l, k  N

Thus all terms on the right hand side of relation (17) vanishes except
when l = k.

 2 l  2  l  k 
1 N 1 jn 
 N 
 N 1 1 N 1 jn 
N
X n e   xk  e N
 …….(17)
n 0 k 0 N n 0 
Inverse Discrete Fourier Transform
N 1 jn2
l k 
Thus,
e
n0
N
 N, for l  k

 0, for l  k
considering 0  l, k  N

Thus all terms on the right hand side of relation (17) vanishes except
when l = k.
 2 l 
1 N 1 jn 
 N 
 N 1  1 N 1 jn 2 Nl  k  
Therefore,  X ne
N n 0
  xk   e
N
 …….(17)
k 0  n  0 
N 1  2l 
1 jn 
 N 
 N
N
X
n0
n e  xl    xl , for l = 0,1,2,…,N-1
N
Inverse Discrete Fourier Transform
N 1  2l 
1 jn 
 N 
 N
N
X
n 0
n e  xl    xl , for l = 0,1,2,…,N-1
N

Now, changing the suffix l to k,

N 1  2k 
1 jn 
 N 

xk   X n e , for k = 0,1,2,…,N-1 …….(18)
N n 0

Relation (18) is known as the Inverse Discrete Fourier Transform (IDFT).

Relations (15) and (18) are called N-point DFT pair.


N-point DFT pair
N-point DFT:
N 1  2 k 
 jn  
 N 
Xn  x
k 0
k e , for n = 0,1,2,…, N-1 …….(15)

N-point IDFT:
N 1  2 k 
1 jn 
 N 

xk 
N
X
n 0
n e , for k = 0,1,2,…,N-1 …….(18)

 2 
 j 
N
Replacing the expression e
by the term WN, the DFT pair takes the form
N 1
X n   x kW Nnk , for n = 0,1,2,…, N-1 …….(19)
k 0
N 1
1 nk …….(20)
xk  
N n 0
X n N , for k = 0,1,2,…,N-1
W
N-point DFT pair
N 1
X n   x kW Nnk , for n = 0,1,2,…, N-1 …….(19)
k 0
N 1
1 nk …….(20)
xk  
N n 0
X n N , for k = 0,1,2,…,N-1
W

 2 
 j 
N
where WN  e
a complex operator (twiddle factor), which rotates any vector through
 2 N Radians.

Here, n = harmonic number and k = sample number.


DFT and IDFT

MATLAB FFT functions


DFT and IDFT
Problem 2
A sequence xk, for k = 0,1,2,3, is given as: x0 = 1, x1 = 2, x2 = 3, and x3 = 4.
Evaluate its DFT Xn.

Solution  2 
 j 
 
 j 
 4   2
Here N = 4. Hence WN  W4  e e
3 3 nk
j
Therefore, X n   x kW4nk   x k e 2

k 0 k 0
3
For n = 0, X 0   x k e  j 0 x0 e  j 0  x1e  j 0  x2 e  j 0  x3 e  j 0
k 0

 x0  x1  x 2  x3  1  2  3  4  10
3 k  3
j j j
For n = 1, X 1   xk e 2
x0 e  j 0  x1e 2
 x 2 e  j  x3 e 2

k 0

 x0  jx1  x 2  jx 3  1  j 2  3  j 4  2  j 2
DFT and IDFT
Problem 2
A sequence xk, for k = 0,1,2,3, is given as: x0 = 1, x1 = 2, x2 = 3, and x3 = 4.
Evaluate its DFT Xn.

Solution (contd.)  2 
 j 
 
 j 
4 2
Here N = 4. Hence WN  W4  e    e  
3 3 nk
j
Therefore, X n   x kW4nk   x k e 2

k 0 k 0
3 2 k
j
For n = 2, X 2   xk e 2
x0 e  j 0  x1e  j  x 2 e  j 2  x3 e  j 3
k 0

 x0  x1  x 2  x3  1  2  3  4  2
3 3 k 3 9
j j j
For n = 3, X 3   xk e 2
x0 e  j 0  x1e 2
 x 2 e  j 3  x 3 e 2

k 0

 x0  jx1  x 2  jx 3  1  j 2  3  j 4  2  j 2
DFT and IDFT
Problem 2
A sequence xk, for k = 0,1,2,3, is given as: x0 = 1, x1 = 2, x2 = 3, and x3 = 4.
Evaluate its DFT Xn.

Solution (contd.)

This result can be verified in MATLAB as:


DFT and IDFT
Problem 3
Using the DFT coefficients Xn, for n = 0,1,2,3, computed in the previous problem,
evaluate its inverse DFT to determine the time domain sequence xk.

Solution  2 
j 
 
j 
Here N = 4. Hence WN1 W41  e  4 
e  2

nk
1 3 1 3 j
Therefore, x k   X nW4 nk   X n e 2
4 n 0 4 n 0

For k = 0,
1 3 1
4 n 0
j0

4

x 0   X n e  X 0 e j 0  X 1e j 0  X 2 e j 0  X 3 e j 0 
1
 X 0  X 1  X 2  X 3 
4
1
 10   2  j 2   2   2  j 2   1
4
DFT and IDFT
Problem 3
Using the DFT coefficients Xn, for n = 0,1,2,3, computed in the previous problem,
evaluate its inverse DFT to determine the time domain sequence xk.

Solution (contd.)  2 
j 
 
j 
1 1 4 2
Here N = 4. Hence WN  W4  e    e  
nk
1 3 1 3 j
Therefore, x k   X nW4 nk   X n e 2
4 n 0 4 n 0

For k = 1,
n  3
1 3 j 1  j j 
x1   X n e 2   X 0 e j 0  X 1e 2  X 2 e j  X 3 e 2 

4 n 0 4 
1
  X 0  jX 1  X 2  jX 3 
4
1
 10  j  2  j 2   2  j  2  j 2   2
4
DFT and IDFT
Problem 3
Using the DFT coefficients Xn, for n = 0,1,2,3, computed in the previous problem,
evaluate its inverse DFT to determine the time domain sequence xk.

Solution (contd.)  2 
j 
 
j 
1 1 4 2
Here N = 4. Hence WN  W4  e    e  
nk
1 3 1 3 j
Therefore, x k   X nW4 nk   X n e 2
4 n 0 4 n 0

For k = 2,
1 3 1

x 2   X n e jn  X 0 e j 0  X 1e j  X 2 e j 2  X 3 e j 3
4 n0 4

1
 X 0  X 1  X 2  X 3 
4
1
 10   2  j 2    2    2  j 2   3
4
DFT and IDFT
Problem 3
Using the DFT coefficients Xn, for n = 0,1,2,3, computed in the previous problem,
evaluate its inverse DFT to determine the time domain sequence xk.

Solution (contd.)  2 
j 
 
j 
1 1 4 2
Here N = 4. Hence WN  W4  e    e  
nk
1 3 1 3 j
Therefore, x k   X nW4 nk   X n e 2
4 n 0 4 n 0

For k = 3,
3 n 3 9
1 3 j 1  j j 
x3   X n e 2   X 0 e j 0  X 1e 2  X 2 e j 3  X 3 e 2 

4 n 0 4 
1
  X 0  jX 1  X 2  jX 3 
4
1
 10  j  2  j 2    2   j  2  j 2   4
4
DFT and IDFT
Problem 3
Using the DFT coefficients Xn, for n = 0,1,2,3, computed in the previous problem,
evaluate its inverse DFT to determine the time domain sequence xk.

Solution (contd.)
This result can be verified in MATLAB as:
Important Properties of DFT
Periodicity

From relation (19),


N 1  2 
 j 
X n   x k W Nnk , for n = 0,1,2,…, N-1, where WN  e N
k 0

N 1
Then,
X n  pN   x k W N n  pN k
for p  0 ,  1,  2 , ….
k 0
N 1
  x k W Nnk , as W NpNk  W NN  pk   1
k 0

 X n

i.e. X n  pN  X n for p  0 ,  1,  2 , …. …….(21)

Thus Xn is periodic with a period N, i.e. the pNth harmonic or at the p times
sampling frequency, the DFT repeats.
Important Properties of DFT
Linearity

DFT DFT
If x1k  X 1n and x 2 k  X 2 n
N N

then for any real-valued or complex-valued constants a1 and a2,

DFT ….
a1 x1k  a 2 x 2 k  a1 X 1n  a 2 X 2 n
N

This property follows immediately from the definition of DFT given in (19).
Important Properties of DFT
Circular symmetries of a sequence

The N-point DFT of a finite duration sequence xk of length L  N, is equivalent to the


N-point DFT of a periodic sequence xpk of period N, which is obtained by periodically
extending xk i.e.

x pk  x
l  
k  lN …….(21a)

Let us assume that the periodic sequence xpk is shifted by m units to the right. Thus
we obtain another periodic sequence, given as:

x pk  x p k  m   x
l  
k  m  lN …….(21b)

The finite duration sequence


 x pk , 0  k  N 1
x k   …….(21c)
 0, otherwise
Is related to the original sequence xk by a circular shift.
Important Properties of DFT
Circular symmetries of a sequence
In general, the circular shift of the sequence can be represented as the index modulo
N. Thus we can write,

x k  xk  m , modulo N   xk  m N …….(21d)

For example, let us assume m = 2 and N = 4. Then we have,

x k  xk  2 4
This implies that
x0  x 2 4  x 2
x1  x1 4  x3
x 2  x0 4  x0
x3  x14  x1
Hence x k is simply xk shifted circularly by two units in time, where counterclockwise
direction has been arbitrarily selected as the positive direction.
Important Properties of DFT
Circular symmetries of a sequence
Hence we can conclude that a circular shift of an N-point sequence is equivalent
to a linear shift of its periodic extension, and vice versa.
The inherent periodicity resulting from the arrangement of the N-point sequence on
the circumference of a circle dictates a different definition of even and odd symmetry,
and time reversal of a sequence.

An N-point sequence is called circularly even if it is symmetric about the point


zero on the circle i.e.

x N  k  xk 1  k  N 1 …….(21e)

An N-point sequence is called circularly odd if it is antisymmetric about the point


zero on the circle i.e.

x N  k   xk 1  k  N 1 …….(21f)

The time reversal of an N-point sequence is attained by reversing its samples


about the point zero on the circle i.e.
x   k N  x  N  k  1  k  N  1 …….(21g)
Important Properties of DFT
Circular symmetries of a sequence

This time reversal is equivalent to plotting xk in a clockwise direction on a circle.

An equivalent definition of even and odd sequences for the associated periodic
sequence xpk is given as:
even : x pk  x p  k   x p  N  k 
odd : x pk   x p  k    x p  N  k  …….(21h)

If the periodic sequence is complex valued, then:

conjugate even : x pk  x *p  N  k 
conjugate odd : x pk   x *p  N  k  …….(21i)
Important Properties of DFT
Circular symmetries of a sequence

Hence we can decompose the sequence xpk as:

x pk  x pe k   x po k  …….(21j)

where

1

x pe k   x pk  x *p  N  k 
2

1

x po k   x pk  x *p  N  k 
2
 …….(21k)
Important Properties of DFT
Symmetry

From relation (19),


N 1  2 
 j 
X n   x k W Nnk , for n = 0,1,2,…, N-1, where WN  e N
k 0

Then, N 1
X pN  n  xW
k 0
k N
pN  n k
for p  0 ,  1,  2 , ….
N 1
  x k W N nk , as W NpNk  W NN  pk   1
k 0

 Xˆ n , conjugate of Xn, if xk is a real sequence.


Thus, X pN  n  Xˆ n , for p  0 ,  1,  2 , …. …….(22)

For p = 0, X  n  Xˆ n and for p = 1, X N n  Xˆ n


Real and imaginary parts of Xn
Multiplication of two DFTs and Circular Convolution
Let us assume that we have two finite duration sequences of length N, x1k and x2k.
Their respective N-point DFTs are:
N 1 -j 2 kn
X 1n   x1k e N
, n  0,1,  , N  1 …….(22a)
k 0
N 1 -j 2 kn
X 2 n   x2 k e N
, n  0,1,  , N  1 …….(22b)
k 0

If these two DFTs are multiplied together, the resultant will be a DFT X3n
of a sequence x3k of length N.
Now our objective is to determine the relationship between x3k and sequences x1k and x2k .

Now, we have:
X 3 n  X 1n X 2 n n  0,1,  , N  1 …….(22c)

The IDFT of {X3n} is:


N 1 j 2 nm N 1 j 2 nm
1 1
x3 m 
N
X
n 0
3n e N

N
X
n0
1n X 2ne N
…….(22d)
Multiplication of two DFTs and Circular Convolution
Substituting X1n and X2n in (22d) using the DFTs in (22a) and (22b), we get:

 j 2 nk  j 2 nl j 2 nm


1 N 1 N 1   N 1 
x3 m 
N
   1k
n0  k 0
x e N
  2l x e N
 e N

  l 0 
1 N 1 N 1  N 1 j 2n Nm  k  l  

N
 x1k  x 2 l   e  …….(22e)
k 0 l 0  n0 

The inner sum in the brackets in (22e) has the form:

N 1  N, a 1
n  N
 a   1  a
n 0  1  a , a  1 …….(22f)

where a is defined as:


j 2  m  k  l 
N …….(22g)
ae
Multiplication of two DFTs and Circular Convolution
We observe that a = 1, when m-k-l is a multiple of N.
On the other hand, aN = 1, for any value of a  0. Hence (22f) gets reduced to:

N 1
n N , l  m  k  pN  m  k N
 a  …….(22h)
n 0  0, otherwise

If we substitute this result in (22e), we obtain the desired expression of x3m as:

N 1
x3 m   x1k x 2 m  k  N , m  0,1,  , N  1 …….(22i)
k 0

The expression in (22i) has the form of a convolution sum.

However it is not the ordinary linear convolution. Instead, the convolution sum in (22i)
Involves the index (m-k)N and is called circular convolution.

Conclusion: The multiplication of the DFTs of two sequences is equivalent to the


circular convolution of the two sequences in the time domain.
Important Properties of DFT
Circular Convolution

DFT DFT
If x1k  X 1n and x 2 k  X 2 n
N N

then

x1k N x 2 k 
DFT
 X 1n X 2 n
N

where x1k N x 2 k denotes the circular convolution of the sequences x1k and x2k.
Computation of DFT
From relation (19),
N 1  2 
 j 
X n   x kW Nnk , for n = 0,1,2,…, N-1, where WN  e N
k 0

It may be represented in matrix form as

X n   W Nnk X k  …….(23)

where Xn and Xk  are N1 column matrices and


W  is an
nk
N
N N square matrix.
Computation of DFT
X n   W Nnk X k  …….(23)

 X0   x0 
X   x 
 1  1 
Here, Xn     , X k    
   
   
 X N1  xN 1 

W N0 W N0 … W N0 
 0  N 1  
W N W N1 … WN 
and W  nk
N  W N0 W N2 … W N2  N 1  
 


 
W 0 W N N 1  … W N N 1 N 1 
 N
Computation of DFT
X n   W Nnk X k  …….(23)

For N = 4, relation (23) becomes

 X 0  W40 W40 W40 W40 x0 


X   0 1 2 3  
 1   W4 W4 W4 W4  x1 
 X 2  W40 W42 W44 W46 x2 
   0 3 6 9  
 X 3  W4 W4 W4 W4  x3 
(Frequency) (Time)
Computation of DFT
X n   W Nnk X k  …….(23)

For N = 4, relation (23) becomes

 X 0  W40 W40 W40 W40 x0 


X   0 1 2 3  
 1   W4 W4 W4 W4  x1 
 X 2  W40 W42 W44 W46 x2 
   0 3 6 9  
 X 3  W4 W4 W4 W4  x3 
(Frequency) (Time)

Hence, computation of X0 requires 4 complex multiplications and 4 complex


additions.
Computation of DFT
X n   W Nnk X k  …….(23)

For N = 4, relation (23) becomes

 X 0  W40 W40 W40 W40 x0 


X   0 1 2 3  
 1   W4 W4 W4 W4  x1 
 X 2  W40 W42 W44 W46 x2 
   0 3 6 9  
 X 3  W4 W4 W4 W4  x3 
(Frequency) (Time)

Hence, computation of X0 requires 4 complex multiplications and 4 complex


additions.
In general, execution of relation (23) requires N2 complex multiplications
and N2 complex additions. Thus computational load increases rapidly
with increasing N. Fast Fourier Transform (FFT) algorithms allow
computation of DFT with reduced computational burden.
Fast Fourier Transform (FFT)
From relation (19),
N 1
X n   xkWNnk , for n = 0,1,2,…, N-1
k 0
Assuming N to be a power of 2, N-point data sequence xk in relation (19)
may be split into two N/2 point data sequences as follows:
N
1
2 N 1
X n   xkWN   xkWNnk
nk

k 0 N
k
2
N N
1 1  N
2 2 n k  
  xkWNnk   x NW N
 2

k 0 k k 0
2
N N
1 nN 1
2 2
  xkWNnk  W  x NWNnk N
2

k 0 k k 0
2
Fast Fourier Transform (FFT)
N N
1 nN 1
2 2
or Xn   xkWNnk  W  x NWNnk N
2

k 0 k k 0
2
nN  2  N
 jn 
 1
 N 2  jn n
Now, W e2
e
N
N
1

2

X n    xkWNnk   1 x N WNnk 
n
Then,
k 0  k

2

N
1

2
 nk
X n    xk   1 x N  WN
n
or …….(24)
k 0 
2 
k
Fast Fourier Transform (FFT)
N
1

2
 nk
X n    xk   1 x N  WN
n
or …….(24)
k 0 
2 
k

Now, splitting (or decimating) Xn into even and odd harmonics,

for even harmonics, n = 2p, for p = 0,1,2,…,(N/2-1) and

for odd harmonics, n = 2p+1, for p = 0,1,2,…,(N/2-1).

For even harmonics,


N N
1 1
2
  2 pk  2
 pk
X 2 p    xk  x N  WN    xk  x N  W N
k 0
 k
2 
k 0
 k
2  2

as WN2 pk  W Npk
2
Fast Fourier Transform (FFT)
N
1
2
  pk
Now, X2p    xk  xk  N  W N
k 0
 2  2

Let, gk  xk  x N , for k = 0,1,2,…(N/2-1)


k
2
N
1
2
Then, X 2 p   g kW Npk …….(25)
k 0
2

This is an N/2 point DFT sequence gk, k = 0,1,2,….(N/2 - 1)


Fast Fourier Transform (FFT)
Now, for odd harmonics [c.f. relation (24)],
N
1
2
   2 p1k
X 2 p1    xk  x N  WN
k 0 
2 
k

N
1
2
  k 2 pk
   xk  x N  WN WN
k 0 
2 
k

N
1
2
  k pk
   xk  x N  WN WN as WN2 pk  WNpk
k 0
 k
2  2 2

 
Let, gk/   xk  x N WNk for k = 0,1,2,…,(N/2-1)
 k
2 
Fast Fourier Transform (FFT)
N
1
2
Then, X 2 p 1   g k/ W Npk …….(26)
k 0
2

This is an N/2 point DFT sequence g’k, k = 0,1,2,….(N/2 – 1)

Thus an N-point DFT may be split into two N/2-point DFTs.

This process of splitting may be continued up to 2-point transforms as N is


a power of 2.
4-point FFT
N
1
Let N = 4. Then from relation (25), 2
X 2 p   g kW Npk …….(25)
N k 0
2
1
2
X 2 p   g kW Npk , for p = 0,1,2,…,(N/2-1)
k 0
2

Where, gk  xk  x N , for k = 0,1,2,…,(N/2-1)


k
2
1
or, X 2 p   g kW 2 pk , for p  0,1
k 0

and, g k  xk  xk  2 , for k  0,1 …….(27)


4-point FFT
1
Now, X 2 p   g kW 2 pk , for p  0,1
k 0

and, g k  xk  xk  2 , for k  0,1 …….(27)

Then for p  0,
1 1
0
X 0   g kW2   gk  g0  g1 …….(28)
k 0 k 0

and for p  1,
1
X 2   g kW2k  g 0W20  g 1W21
k 0

 g 0   1g 1  g 0  g1 …….(29)
4-point FFT
N
1
2
Now from relation (26), X 2 p 1   g k/W Npk …….(26)
k 0
2
N
1
2
X 2 p1   g k/WNpk , for p = 0,1,2,…,(N/2-1)
k 0
2

/   k
where g k   xk  x N WN , for k = 0,1,2,…,(N/2-1)
 k
2 

1
or, X 2 p1   g k/W2 pk , for p  0,1
k 0

and, g k/   x k  x k  2 W 4k , for k  0,1 …….(30)


4-point FFT
1
Now, X 2 p1   g k/W2 pk , for p  0,1
k 0

and, g k/   x k  x k  2 W 4k , for k  0,1 …….(30)

Then for p  0,
1
X 1   g k/W20  g 0/  g1/ …….(31)
k 0

and for p  1,
1
X 3   gk/W2k  g0/  g1/W21
k 0

 g0/  g1/ …….(32)


4-point FFT
Now from relations (27) and (30), for k  0 ,1

g0  x0  x2
g1  x1  x3

g 0/   x0  x2 W40  x0  x2  x0  x2W42

g1/   x1  x3 W41  x1W41  x3W41  x1W41  x3W43


Then in matrix form,
 g 0  1 0 1 0   x0 
 g  0 1 0 1   x1 
 1     …….(33)
 g 0/   1 0 W4 2
0   x2 
 /  1  
g
 1  0 W 4
0 W 43   x 3 
4-point FFT
From relations (28), (29), (31) and (32),

X 0  g 0  g1
X 2  g 0  g1
X 1  g 0/  g1/
X 3  g 0/  g1/
Then in matrix form,

 X 0  1 1 0 0 g0 
 X  1 1 0 0   g1 
 2     …….(34)
 X 1  0 0 1 1   g 0/ 
    
 X 3  0 0 1  1  g 1/ 
4-point FFT
From relations (33) and (34),

 g 0  1 0 1 0   x0  Time
 g  0 1 0 1   x1 
history
 1    
 g 0/   1 0 W 42 0   x2 
 /  1  
g
 1  0 W 4
0 W 43   x 3 

Frequency  X 0  1 1 0 0 g0
 X  1 1 0 0   g1 
 2    
 X 1  0 0 1 1   g 0/ 
    
 X 3  0 0 1  1  g 1/ 
Bit reversed order
4-point FFT

Frequency  X 0  1 1 0 0 g0
 X  1 1 0 0   g1 
 2    
 X 1  0 0 1 1   g 0/ 
    
 X 3  0 0 1  1  g 1/ 
Bit reversed order

since,
X 0  X 00 
X 2  X10 
 in terms of binary bits
X1  X 01 
X 3  X11 
Signal Flow Graph for N = 4
From relations (33) and (34),
 g 0  1 0 1 0   x0   X 0  1 1 0 0 g0 
 g  0 1 0 1   x1   X  1 1 0 0   g1 
 
1
   2    
/ 2
 g 0  1 0 W4 0   x2   X 1  0 0 1 1   g 0/ 
 /  1       
 g1  0 W4 0 W43   x3   X 3  0 0 1  1  g 1/ 

Number of iterations = M, where M = log2N [as N = 2M], here N = 4 and M = 2


Signal Flow Graph for N = 4

Each iteration involves N/2 number of butterfly computations.


Computation of g1 and g1/ may be represented as:

x1 g1 x1 g1
j w43
computation w42 w40
w41 butterfly -1 1
x3 g1/
x3 g1/ -j w41
w43 = - w41
Signal Flow Graph for N = 4

Each iteration involves N/2 number of butterfly computations.


Computation of g1 and g1/ may be represented as:

x1 g1 x1 g1 j w43
w42 w40
w41 -1 1
w4 1
x3 g1/ g 1/ -j w41
x3
w43 = - w41
-1
This involves two complex additions and one complex multiplication.
This is true for all butterflies.
Signal Flow Graph for N = 4

The procedure can be summarized as,

No. of iterations = M  log 2 N


NM N
Total no. of butterflies =  log2 N
2 2
No. of complex multiplications per butterfly = 1

No. of complex additions per butterfly = 2


NM N
Total no. of complex multiplications =  log2 N
2 2
Total no. of complex additions = NM  N log 2 N
Signal Flow Graph for N = 4

Computation of each butterfly may be carried out in-place to reduce memory


requirement as follows:

A A A
T  A B
Butterfly A A B
B B
B T B  T W
-1

Here T is a scratch-pad variable and W is the twiddle factor.


Signal Flow Graph for N = 4

The above algorithm for the computation of FFT of sequence xk, k = 0,1,2,….,(N-1)
may be called radix-2 decimation-in-frequency in-place FFT algorithm.
Here, N should be a power of 2.

Similarly, radix-2 decimation-in-time in-place FFT algorithm may be derived


with same computation load.
Comparison of computational loads of DFT and FFT

DFT FFT
N complex complex complex complex
additions multiplications additions multiplications
4 16 16 8 4
8 64 64 24 12
16 256 256 64 32
32 1024 1024 160 80
8-point FFT
Relations (25) and (26) may be split further (i.e. decimated) into N/2-point
DFTs as follows:

N
1
2
X 2 p   gkWNpk …….(25)
k 0 2
N
1
2
X 2 p1   gk/WNpk …….(26)
k 0 2
8-point FFT
Relations (25) and (26) may be split further (i.e. decimated) into N/2-point
DFTs as follows:

N
1
In relation (25), splitting N/2-point sequence 2
X 2 p   gkWNpk …….(25)
g k into two N/4-point sequences, k 0 2
N N
1 1
4 2
X 2 p   g kW Npk   g kW Npk
k 0 N
2 k 2
4
N N
1 1  N 
4 4 p k 
  g kW Npk   g N W N
 4 

k 0 k
k 0
2 4 2

N N
1 1 pN
4 4
  g kW Npk   g N W Npk W N
4

k 0 k
k 0
2 4 2 2
8-point FFT
N N
1 1 pN
4 4
Now, X 2 p   g kW Npk   g N W pk
N W N
4
k
k 0 2 k 0 4 2 2
pN
p
Here, W N
4
  1
2
N
1

4

   g k   1 g N W Npk
p
Therefore, X 2p …….(35)
k 0 
4 
k
2

Now splitting X2p into even and odd harmonics,

for even harmonics, p  2 r , for r = 0,1,2,…,(N/4-1)

and for odd harmonics, p  2r 1 , for r = 0,1,2,…,(N/4-1)


8-point FFT
Now, for even harmonics,
N
1
4
 
X 4 r    g k  g N W N2 rk
k 0 
4 
k
2
N
1
4
 
   g k  g N W Nrk
k 0 
4 
k
4

Let hk  g k  g N , for k = 0,1,2,…,(N/4-1)


k
4
N
1
4
Then, X 4 r   hkW Nrk , for r = 0,1,2,…,(N/4-1) …….(36)
k 0
4

This is an N/4-point DFT of sequence hk , k = 0,1,2,…,(N/4-1)


8-point FFT
Now, for odd harmonics,
N
1
4
 
X 4 r  2    g k  g N W N 2 r 1 k
k 0 
4 
k
2

N
1
4
 
   g k  g N W N2 kW Nrk
k 0 
4 
k
4

/   2k
Let h   g k  g N
k
WN ,
 for k = 0,1,2,…,(N/4-1)
k
 4 
N
1
4
Then, X 4 r  2   hk/W Nrk , for r = 0,1,2,…,(N/4-1) …….(37)
k 0
4

This is an N/4-point DFT of sequence hk/ , k = 0,1,2,…,(N/4-1)

Thus the N/2-point DFT as represented in relation (25), may be split


into two N/4-point DFTs, as represented in relations (36) and (37).
8-point FFT
Similarly, the N/2-point DFT in relation (26) may N
1
be split into two even and odd harmonic N/4- 2

point DFTs as follows: X 2 p 1   g k/ WNpk …….(26)


k 0 2

For even harmonics,


N
1
4
X 4r1   lkWNrk , for r = 0,1,2,…,(N/4-1) …….(38)
k 0
4

This is an N/4-point DFT where lk  gk/  g / N , for k = 0,1,2,…,(N/4-1)


k
4
8-point FFT
N
1
2
X 2 p 1   g k/ WNpk …….(26)
k 0 2
Similarly for odd harmonics,
N
1
4
X 4 r  3   l k/W Nrk , for r = 0,1,2,…,(N/4-1) …….(39)
k 0
4

This is another N/4-point DFT where

/  / /  2k
lk   g k  g N WN , for k = 0,1,2,…,(N/4-1)
 k
4 
8-point FFT
N
Let N = 8 (= 23) for 8-point FFT. 2
1

X 2 p   gkWNpk …….(25)
k 0 2
In relation (25),

g k  xk  x N , for k = 0,1,2,…,(N/2-1)
k
2

Possible values of k are k = 0,1,2,3.

Then, g0  x0  x 4 
g1  x1  x5 
 …….(40)
g2  x 2  x6 
g3  x3  x7 
8-point FFT
N
1
2
X 2 p 1   g k/ WNpk …….(26)
Now in relation (26), k 0 2

/   k
gk   xk  x N WN , for k = 0,1,2,…,(N/2-1)
 k
2 

Possible values of k are k = 0,1,2,3.

Then, g 0/   x0  x4 W80 
g 1/   x1  x5 W81 
…….(41)
2
g 2   x2  x6 W8 
/

g 3/   x3  x7 W83 
8-point FFT
g0  x0  x4  g 0/  x 0
 x 4 W 8
0


x 5  g 1/  x  x 5 W 1
g1  x1  1 8  …….(41)
 …….(40) 
g2  x2  x6  g /
2
 x 2
 x 6 W 8
2

g3  x3  x 7  g /
3
 x 3
 x 7 W 8
3


From relations (40) and (41), signal flow graph for computations of
g03 and g0/ 3 may be represented as:
8-point FFT
Now from relation (36),

hk  gk  g N , for k = 0,1,2,…,(N/4-1)
k
4

Possible values of K are K = 0,1.

Then, h0  g 0  g 2 
 …….(42)
h1  g1  g3 
8-point FFT
And from relation (37),

/   2k
hk   g k  g N WN , for k = 0,1,2,…,(N/4-1)
 k
4 

Possible values of K are K = 0,1.

Then, h0/   g 0  g 2 W80 


…….(43)
2 
h1   g1  g 3 W8 
/
8-point FFT
Now from relation (38),

lk  gk/  g / N , for k = 0,1,2,…,(N/4-1)


k
4

Possible values of K are K = 0,1.

Then, l0  g0/  g2/ 


…….(44)
/ /
l1  g1  g3 
8-point FFT
And from relation (39),

/  / /  2k , for k = 0,1,2,…,(N/4-1)
lk   gk  g N WN
 k
4 

Possible values of K are K = 0,1.

Then,
l 0/   g 0/  g 2/ W 8 0  …….(45)
2 
l1   g 1  g 3 W 8 
/ / /
8-point FFT
h0  g 0  g 2  h0/   g 0  g 2 W80  l0  g 0/  g 2/  l 0/   g 0/  g 2/ W 80 
…….(42) …….(43) …….(44) …….(45)
h1  g 1  g 3  h1/   g1  g 3 W82  l1  g 1/  g 3/  l1/   g 1/  g 3/ W 8 2 

From relations (42), (43), (44) and (45), signal flow graph for computation of
/ /
h01 , h01 , l 0 1
and l 0 1
may be represented as:
8-point FFT
Now, from relation (36), N
4
1

X 4 r   h k W Nrk , for r = 0,1,2,…,(N/4-1) …….(36)


possible values of r are r = 0,1. k 0
4

Then,
X 0  h0W 20  h1W 20  h0  h1 
 …….(46)
0 1
X 4  h0W 2  h1W 2  h0  h1 
And, from relation (37), N
4
1

X 4 r  2   h k/W Nrk , for r = 0,1,2,…,(N/4-1) …….(37)


possible values of r are r = 0,1. k 0
4

Then,

X 2  h0/W 20  h1/W 20  h0/  h1/ 


/ 0 / 1 / / 
…….(47)
X 6  h0W 2  h1 W 2  h0  h1 
8-point FFT
From relation (38), N
4
1

X 4 r 1   l kW Nrk , for r = 0,1,2,…,(N/4-1) …….(38)


possible values of r are r = 0,1. k 0
4

Then,
X 1  l0W20  l1W20  l0  l1 
 …….(48)
0 1
X 5  l0W2  l1W2  l0  l1 
And, from relation (39), N
4
1

possible values of r are r = 0,1. X 4 r 3   lk/W Nrk , for r = 0,1,2,…,(N/4-1) …….(39)


k 0
4

Then,

X 3  l0/W20  l1/W20  l0/  l1/ 


…….(49)
/ 0 / 1 / /
X 7  l0W2  l1W2  l0  l1 
8-point FFT
X 0  h0W20  h1W20  h0  h1  X 2  h0/W20  h1/W20  h0/  h1/ 
 …….(46)  …….(47)
X 4  h0W20  h1W21  h0  h1  X 6  h0/W20  h1/W21  h0/  h1/ 

X 1  l0W 20  l1W 20  l0  l1  X 3  l 0/W 20  l1/W 20  l 0/  l1/ 


 …….(48)  …….(49)
X 5  l0W 20  l1W 21  l0  l1  X 7  l 0/W 20  l1/W 21  l 0/  l1/ 
From relations (46), (47), (48) and (49), signal flow graph for computation of
X 07 may be represented as:

not in natural order, hence bit-reversal


should be carried out to bring it in
natural order
8-point FFT
Bit Reversal procedure
8-point FFT
Complete Signal Flow Graph

Time Frequency
history
FORTRAN subroutine to compute radix-2 FFT
C ***Subroutine to compute radix-2 FFT***
C Decimation-in-frequency in-place algorithm
SUBROUTINE FFT(A,N,INV)
C N: Dimension of Array (must be a power of 2)
C A: Complex array containing data sequence
C DFT coefficients are returned in the array
C INV = 0 for forward FFT
C INV = 1 for inverse FFT
DIMENSION A(N)
COMPLEX T,W,A
IF (INV.EQ.0) GO TO 8
C Divide sequence by N for inverse FFT
DO 7 I=1,N
7 A(I)=A(I)/CMPLX(FLOAT(N),0.0)
8 S=-1.0
IF (INV.EQ.1) S=1.0
FORTRAN subroutine to compute radix-2 FFT
C Calculate number of iterations
C M: Number of iterations (log(N) to the base 2)
M=1
K=N
2 K=K/2
IF (K.EQ.1) GO TO 1
M=M+1
GO TO 2
C Compute for each iteration
C NP: Number of points in each partition
1 NB=N
DO 3 I=1,M
NP=NB
NB=NP/2
PHI=3.14159265/FLOAT(NB)
FORTRAN subroutine to compute radix-2 FFT
C Compute for each iteration
C NP: Number of points in each partition
1 NB=N
DO 3 I=1,M
NP=NB
NB=NP/2
PHI=3.14159265/FLOAT(NB)
C Calculate the twiddle factor W for each butterfly
C NB: Number of butterflies for each partition
DO 3 J=1,NB
ARG=FLOAT(J-1)*PHI
W=CMPLX(COS(ARG),S*SIN(ARG)) Nested DO loop
C Compute butterfly for each partition
DO 3 K=NP,N,NP
J1=K-NP+J
J2=J1+NB
T=A(J1)-A(J2)
A(J1)=A(J1)+A(J2)
A(J2)=T*W
3 CONTINUE
FORTRAN subroutine to compute radix-2 FFT
C Bit reversal operation
N2=N/2
N1=N-1
J=1
DO 4 I=1,N1
IF (I.GE.J) GO TO 5
T=A(J)
A(J)=A(I)
A(I)=T
5 K=N2
6 IF (K.GE.J) GO TO 4
J=J-K
K=K/2
GO TO 6
4 J=J+K
RETURN
END

During the bit-reversal operation, N/2 DFT coefficients remain unchanged and
the remaining N/2 coefficients are exchanged in place as required.
Applications of FFT
Computation of amplitude spectrum of a finite real data sequence

Real N-point Form


data xk complex Compute Compute
Xn
sequence x k, array of amplitudes
N- point
k=0, 1, …, length N C n, n=0, 1,
(N-1) from x k, k=0, FFT … , ((N/2)-1)
1, … , (N-1)

(N must be a
power of 2)

1
C0  X0 , the average value
N
2
and Cn  X n , for n = 1,2,…,(N/2-1), the nth harmonic amplitude.
N
Applications of FFT
Computation of amplitude spectrum of a finite real data sequence

The range of frequency may be expressed as fs/2 where fs is the sampling


frequency   1  .
  
The frequency resolution may be estimated as f0 where f0 is the fundamental
frequency (=1/T0 ), where T0 is the time period of fundamental frequency and also
the width of the analysis window.
Applications of FFT
FORTRAN program for computation of amplitude spectrum

C ***Amplitude spectrum analysis program using FFT***


DIMENSION A(1024),B(1024),C(512),PHASE(512)
COMPLEX A
CHARACTER*64 FNAME
WRITE(*,10)
10 FORMAT(1X,'Enter file name - '\)
READ(*,20)FNAME
20 FORMAT(A)
OPEN(2,FILE=FNAME)
READ(2,*,END=100)(B(I),I=1,1024)
100 N=I-1
CLOSE(2)
WRITE(*,200)N
200 FORMAT(1X,'Data points = ',I4)
Applications of FFT
FORTRAN program for computation of amplitude spectrum

DO 15 I=1,10
IF(N-2**I)24,25,15
15 CONTINUE
24 WRITE(*,5)
5 FORMAT(1X,'Incorrect size - it must be a power of 2')
STOP
25 DO 30 I=1,N
30 A(I)=CMPLX(B(I),0.0)/CMPLX(FLOAT(N),0.0)
WRITE(*,300)
300 FORMAT(1X,'FFT analysis in progress')
CALL FFT(A,N,0)
Applications of FFT
FORTRAN program for computation of amplitude spectrum

NA=N/2
C(1)=CABS(A(1))
DO 40 I=2,NA
40 C(I)=CABS(A(I))*2.0
D=180.0/3.141592654
DO 80 I=2,NA
R=REAL(A(I))
X=AIMAG(A(I))
ALPHA=ATAN2(X,R)
80 PHASE(I)=D*ALPHA
Applications of FFT
FORTRAN program for computation of amplitude spectrum

WRITE(*,60)
60 FORMAT('0','Harmonic no.',7X,'Amplitude',12X,'Phase (deg)')
WRITE(*,70)
70 FORMAT(1X,'------------',7X,'---------',12X,'-----------'//)
NB=0
WRITE(*,75)NB,C(1)
75 FORMAT(5X,I3,9X,1P,E13.6)
DO 85 I=2,NA
NB=I-1
85 WRITE(*,90)NB,C(I),PHASE(I)
90 FORMAT(5X,I3,9X,1P,E13.6,9X,E13.6)
END
Applications of FFT
FFT-based digital filtering of a finite real data sequence
convolution

xk Digital yk
input output
sequence Filter sequence

yk = hk * xk, hk is the impulse sequence of the digital filter


Applications of FFT
FFT-based digital filtering of a finite real data sequence
convolution

xk Digital yk
yk = hk * xk
input output
sequence Filter sequence

multiplication

FFT IFFT
xk Xn Hn Yn yk

Yn = Hn . Xn, Hn is the complex gain of the digital filter


Applications of FFT
FFT-based digital filtering of a finite real data sequence
m u ltip lic a tio n

FFT IF F T
xk Xn H Yn yk
n Yn = Hn . Xn

N-point Real Com pute


Form N-point Xn
data sequence
com plex N- point
x k , k=0, 1, … ,
array
(N-1) FFT
output
input Com pute
Yn sequence
sequence m ultiplier  N- point y k,
k=0, 1,… ,
IFFT
(N-1)
((N/2)+1)-point Form com plex
array (H n ) of
gain and phase length N using
characteristic com plex Hn
conjugates

Filter specification Frequency


(upto folding frequency) response
Applications of FFT
FFT-based digital filtering of a finite real data sequence

N -p oin t R eal C om p u te
d ata seq u en ce F orm N -p oin t Xn
com p lex N - p oin t
x k , k= 0, 1, … ,
array
(N -1) FFT
ou tp u t
inp u t C om p u te
Yn seq u en ce
seq u en ce m ultip lier  N - p oin t y k,
k= 0, 1,… ,
IF F T
(N -1)
((N /2)+1)-p oin t F orm com p lex
array (H n ) of
gain an d p h ase len gth N u sin g
ch aracteristic com p lex Hn
con ju gates

F ilter sp ecification F req u ency


(u p to fo ld in g frequ en cy) resp on se

Hn Hn

N/2 n N/2 N-1 n


Applications of FFT
FORTRAN program for FFT-based digital filtering

C ***FFT based digital filter program***


DIMENSION X(1024),A(513),PH(513)
COMPLEX H(1024),CX(1024)
CHARACTER*64 FNAME1,FNAME2
WRITE(*,20)
20 FORMAT(1X,'Enter input file name - '\)
READ(*,30)FNAME1
30 FORMAT(A)
WRITE(*,40)
40 FORMAT(1X,'Enter output file name - '\)
READ(*,30)FNAME2
Applications of FFT
FORTRAN program for FFT-based digital filtering

OPEN(1,FILE=FNAME1)
READ(1,*,END=50)(X(I),I=1,1024)
GOTO 60
50 I=I-1
60 N=I
WRITE(*,70)N
70 FORMAT(1X,'Data points = ',I4)
DO 375 I=1,10
IF(N-2**I)380,390,375
375 CONTINUE
380 WRITE(*,400)
400 FORMAT(1X,'Incorrect size of data')
STOP
Applications of FFT
FORTRAN program for FFT-based digital filtering

390 WRITE(*,100)N/2+1
100 FORMAT(1X,'Enter filter gain (',I3,' points)')
READ(*,*)(A(I),I=1,N/2+1)
PH(1)=0.0
WRITE(*,110)N/2
110 FORMAT(1X,'Enter filter phase (',I3,' points)')
READ(*,*)(PH(I),I=2,N/2+1)
C Form complex filter gain array
H(1)=CMPLX(A(1)*N,0.0)
DO 200 I=2,N/2+1
200 H(I)=CMPLX(A(I)*N*COS(PH(I))/2.0,A(I)*N*SIN(PH(I))/2.0)

H n

N /2 n
Applications of FFT
FORTRAN program for FFT-based digital filtering

390 WRITE(*,100)N/2+1
100 FORMAT(1X,'Enter filter gain (',I3,' points)')
READ(*,*)(A(I),I=1,N/2+1)
PH(1)=0.0
WRITE(*,110)N/2
110 FORMAT(1X,'Enter filter phase (',I3,' points)')
READ(*,*)(PH(I),I=2,N/2+1)
C Form complex filter gain array
H(1)=CMPLX(A(1)*N,0.0)
DO 200 I=2,N/2+1
200 H(I)=CMPLX(A(I)*N*COS(PH(I))/2.0,A(I)*N*SIN(PH(I))/2.0)
C Form rest of the gain array by complex conjugate
DO 340 I=2,N/2
J=N+2-I
340 H(J)=CONJG(H(I))
H n

N /2 N -1 n
Applications of FFT
FORTRAN program for FFT-based digital filtering

C Form complex input data array


DO 350 I=1,N
350 CX(I)=CMPLX(X(I),0.0)
C Compute FFT
CALL FFT(CX,N,0)
C Perform filtering in frequency domain
DO 360 I=1,N
360 CX(I)=CX(I)*H(I)
C Back to time
CALL FFT(CX,N,1)
DO 370 I=1,N
370 X(I)=REAL(CX(I))

Multiplication
FFT IFFT
xk Xn Hn Yn yk
Applications of FFT
FORTRAN program for FFT-based digital filtering

C Save output
IF(FNAME1.EQ.FNAME2)CLOSE(1)
OPEN(2,FILE=FNAME2,STATUS='NEW')
WRITE(2,*)(X(I),I=1,N)
END

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy