Top Banner
Email: [email protected] [email protected] Cell: 9952749533 www.researchprojects.info PAIYANOOR, OMR, CHENNAI Call For Research Projects Final year students of B.E in EEE, ECE, EI, M.E (Power Systems), M.E (Applied Electronics), M.E (Power Electronics) Ph.D Electrical and Electronics. Students can assemble their hardware in our Research labs. Experts will be guiding the projects.
84

Dft

Nov 30, 2014

Download

Technology

Senthil Kumar

EXPERT SYSTEMS AND SOLUTIONS
Project Center For Research in Power Electronics and Power Systems
IEEE 2010 , IEEE 2011 BASED PROJECTS FOR FINAL YEAR STUDENTS OF B.E
Email: [email protected],
Cell: +919952749533, +918608603634
www.researchprojects.info
OMR, CHENNAI
IEEE based Projects For
Final year students of B.E in
EEE, ECE, EIE,CSE
M.E (Power Systems)
M.E (Applied Electronics)
M.E (Power Electronics)
Ph.D Electrical and Electronics.
Training
Students can assemble their hardware in our Research labs. Experts will be guiding the projects.
EXPERT GUIDANCE IN POWER SYSTEMS POWER ELECTRONICS
We provide guidance and codes for the for the following power systems areas.
1. Deregulated Systems,
2. Wind power Generation and Grid connection
3. Unit commitment
4. Economic Dispatch using AI methods
5. Voltage stability
6. FLC Control
7. Transformer Fault Identifications
8. SCADA - Power system Automation

we provide guidance and codes for the for the following power Electronics areas.
1. Three phase inverter and converters
2. Buck Boost Converter
3. Matrix Converter
4. Inverter and converter topologies
5. Fuzzy based control of Electric Drives.
6. Optimal design of Electrical Machines
7. BLDC and SR motor Drives
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dft

EXPERT SYSTEMS AND SOLUTIONS

Email: [email protected]@yahoo.comCell: 9952749533

www.researchprojects.info PAIYANOOR, OMR, CHENNAI

Call For Research Projects Final year students of B.E in EEE, ECE, EI, M.E (Power Systems), M.E (Applied

Electronics), M.E (Power Electronics)Ph.D Electrical and Electronics.

Students can assemble their hardware in our Research labs. Experts will be guiding the

projects.

Page 2: Dft

Discrete Fourier Transform &

Fast Fourier Transform

Page 3: Dft

Review The DTFT provides the frequency-domain (w)

representation for absolutely summable sequences. The z-transform provides a generalized frequency-

domain (z) representation for arbitrary sequences. Two features in common:

Defined for infinite-length sequences Functions of continuous variable (w or z) From the numerical computation viewpoint, these two

features are troublesome because one has to evaluate infinite sums at uncountably infinite frequencies.

Page 4: Dft

Review To use Matlab, we have to truncate sequences and

then evaluate the expression at finitely many points. The evaluation were obviously approximations to the

exact calculations. In other words, the DTFT and the z-transform are not

numerically computable transform.

Page 5: Dft

Introduction Therefore we turn our attention to a numerically computable

transform. It is obtained by sampling the DTFT transform in the frequency

domain (or the z-transform on the unit circle). We develop this transform by analyzing periodic sequences. From FT analysis we know that a periodic function can always

be represented by a linear combination of harmonically related complex exponentials (which is form of sampling).

This give us the Discrete Fourier Series representation. We extend the DFS to finite-duration sequences, which leads

to a new transform, called the Discrete Fourier Transform.

Page 6: Dft

Introduction The DFT avoids the two problems mentioned above

and is a numerically computable transform that is suitable for computer implementation.

The numerical computation of the DFT for long sequences is prohibitively time consuming.

Therefore several algorithms have been developed to efficiently compute the DFT.

These are collectively called fast Fourier transform (or FFT) algorithms.

Page 7: Dft

The Discrete Fourier Series Definition: Periodic sequence

N: the fundamental period of the sequences From FT analysis we know that the periodic functions can be

synthesized as a linear combination of complex exponentials whose frequencies are multiples (or harmonics) of the fundamental frequency (2pi/N).

From the frequency-domain periodicity of the DTFT, we conclude that there are a finite number of harmonics; the frequencies are {2pi/N*k,k=0,1,…,N-1}.

knkNnxnx ,),(~)(~

Page 8: Dft

The Discrete Fourier Series A periodic sequence can be expressed as

,1,0,)(~1

)(~1

0

2

nekX

Nnx

N

k

knj N

},1,0),(~

{ kKX are called the discrete Fourier series coefficients, which are given by

,1,0,)(~)(~ 1

0

2

kenxkXN

n

knj N

The discrete Fourier series representation of periodic sequences

Page 9: Dft

The Discrete Fourier Series

X(k) is itself a (complex-valued) periodic sequence with fundamental period equal to N.

1

0

1

0

)(~1

)](~

[IDFS)(~

)(~)](~[DFS)(~

Let2

N

k

nkN

N

n

nkN

jN

WkXN

kXnx

WnxnxkX

eW N

Example 5.1

Page 10: Dft

To perform frequency analysis on a discrete-time signal, x(n), need to convert the time-domain to an equivalent frequency-domain

representation. In order to this, need to use a powerful computational tool to perform frequency analysis called

Discrete Fourier Transform or DFT. The continuous Fourier Transform is defined as below:

However, this integral equation of Fourier Transform is not suitable to perform frequency analysis due to this 2 reasons:

Continuous nature can be handled by Computer The limits of integration cannot be from minus infinity to infinity. There

should be a finite length sequences that can be handled by computer.

DFT : DEFINATION

Page 11: Dft

DFT : DEFINATION

Let x(n) be a finite length sequences. Thus, the N-point DFT of x(n) defined as X(k) is : X(k) = e-j2nk/N, k = 0,1, …, N-1

k represent the harmonic number of the transform component. n is the finite length sequence interval defined as 0 ≤ n ≤ N-1, N is the sequence length Thus X(k) being complex and has real & imaginary

component, so that the kth harmonic of X(k) is: X(k) = R(k) + jI(k)

1

0

)(N

n

nx

Page 12: Dft

DFT : PROPERTIES

The are 4 properties of DFT: 1. Periodicity If X(k) is the N-point DFT of x(k), x(n+N) = x(n), for all n X(k+N) = X(k), for all k It shows that DFT is periodic with period N, also known as Cyclic property of the DFT

2. Linearity If X1(k) and X2(k) are the N-point DFT of x1(n) and x2(n), ax1(n) + bx2(n) DFT aX1(k) + bX2(k)

Page 13: Dft

3. Circular Shifting

Let x(n) be a sequence of length N and X(k) is N

-point DFT, thus the sequence, x,(n) obtained from

x(n) by shifting x(n) cyclically by m units. Then,

x,(n) DFT X(k)e-j2km/N

4. Parseval’s Theorem

if x(n) DFT X(k) and y(n) DFT Y(k) thus, y*(n) = 1/N Y*(k)

1

0

)(N

n

nx

1

0

)(N

k

kX

Page 14: Dft

DFT : RELATIONSHIP WITH z-TRANSFORM

The z-transform of the sequence, x(n) is given by:

X(z) = z-n , ROC include unit circle

by defining zk = ej2k/N, k = 0, 1, 2, …, N-1

X(k) = X(z)| zk = ej2k/N , k = 0,1,2, …, N-1

= e-j2nk/N

where ωk = 2k/N, k = 0,1,2,…,N-1

n

nx )(

n

nx )(

Page 15: Dft

DFT : EXAMPLES

EXAMPLE 1: EXAMPLE 1:

Find the DFT for the following finite length sequence, x(n) = { ¼, ¼, ¼ } Solution :Solution : 1. Determine the sequence length, N N = 3, k = 0,1,2 2. Use DFT formula to determine X(k)

X(k) = e-j2nk/N , k = 0, 1, 2

X(0) = ¼ + ¼ + ¼ = ¾ X(1) = ¼ + ¼e-j2/3 + ¼e-j4/3

= ¼ + ¼ [cos (2/3) – jsin(2/3) + ¼ [cos (4/3) –jsin(4/3) = ¼ + ¼ [-0.5 – j0.866] + ¼ [ -0.5 + j0.866] = ¼ + ¼ [-1] = 0

1

0

)(N

n

nx

Page 16: Dft

Continued from Examples 1:Examples 1:

X(2) = ¼ + ¼ e-j4/3 + ¼ e-j8/3

= ¼ + ¼ [cos (4/3) – jsin(4/3)] + ¼ [cos (8/3) – jsin(8/3)] = ¼ + ¼ [-0.5 +j0.866] + ¼[-0.5 – j0.866] = 0 Thus,

X(k) = { ¾, 0, 0}

Page 17: Dft

Examples 2:Examples 2: Given the following the finite length sequences, x(n) = {1,1,2,2,3,3} Perform DFT for this sequences. Solution : Solution : 1. Determine the sequence length, N = 6. 2. Use DFT formula to determine X(k).

X(k) = e-j2nk/N , k = 0,1,2,3,4,5 X(0) = 12, X(1) = -1.5 + j2.598 X(2) = -1.5 + j0.866, X(3) = 0 X(4) = -1.5 – j0.866, X(5) = -1.5 – j2.598 Thus, X(k) = {12, -1.5 + j2.598, -1.5 + j0.866, 0, -1.5 – j0.866, -1.5 – j2.598}

1

0

)(N

n

nx

Page 18: Dft

Examples 3:Examples 3: Find the DFT for the convolution of 2 sequences : x1(n) = {2, 1, 2, 1} & x2(n) = {1, 2, 3, 4}

Solution :Solution : 1. Determine the sequence length for each sequence, N = 4. Thus, k = 0,1,2,3 2. Perform DFT for each sequences, (i) X1(0) = 6, X1(1) = 0, X1(2) = 2, X2(3) = 0 X1(k) = {6,0,2,0}

(ii) X2(0) = 10, X2(1) = -2+j2, X2(2) = -2, X2(3) = -2-j2 X2(k) = {10,-2+j2,-2,-2-j2}

3. Perform Convolution by : X3(k) = X1(k) X2(k) = {60, 0, -4, 0}

Page 19: Dft

IDFT : DEFINATION

IDFT is the inverse Discrete Fourier Transform.

The finite length sequence can be obtained from the Discrete Fourier

Transform by performing IDFT.

The IDFT is defined as :

x(n) = 1/N e-j2nk/N,

where n = 0,1, …, N-1

1

0

)(N

k

kX

Page 20: Dft

EXAMPLES 4:EXAMPLES 4: Determine the IDFT for the following DFT sequence, X(k) = {1, 2, 3, 4} SOLUTION :SOLUTION : 1. Determine the length of the sequence, N = 4 2. Calculate the IDFT by the IDFT formula:

x(n) = 1/4 e-j2nk/4,

x(0) = ¼(1 + 2 + 3 + 4) = 5/2 x(1) = -0.5 – j0.5, x(2) = -0.5 x(3) = -0.5 + j0.5 3. Thus the finite length sequence, x(n) is: x(n) = {2.5, -0.5-j0.5, -0.5, -0.5+j0.5}

3

0

)(k

kX

Page 21: Dft

IDFT : EXAMPLES

EXAMPLES 5:EXAMPLES 5: Obtain the finite length sequence, x(n) from the DFT sequence in Example 3. Solution : 1. The sequence in Example 3 is : X3(k) = {60, 0, -4, 0} 2. Use IDFT formula to obtain x(n):

x3(n) = 1/4 e-j2nk/4,

x3(0) = 14, x3(1) = 16, x3(2) = 14, x3(3) = 16

Thus the finite length sequences are : x3(k) = {14, 16, 14, 16}

3

0

)(k

kX

Page 22: Dft

DFT & IDFT : COMPLEXITY OF DFT

A Large number of multiplications and additions are required to compute

DFT.

To compute the 8-point of DFT of the sequence, x(n),

The X(k) will be the summation of x(0)e-j2(0)k/8 until x(7)e-j2(7)k/8 For the

eight terms, there will be 64 multiplication (82) and 56 addition (8 x (8-

1))

Hence, for N-point DFT, there will be N2 multiplication and N(N-1)

addition.

Page 23: Dft

Thus, need one algorithm to reduce the number of calculation and

speeds up the computation of DFT. The algorithm is called Fast

Fourier Transform (FFT). It utilizes special properties of the DFT to

construct a computational procedure that requires Nlog2N complex

multiplication and Nlog2N complex addition to carry out N-point DFT.

The MATLAB command use to perform DFT & IDFT is:

1. fft2 () - for DFT

2. ifft2 () - for IDFT

Page 24: Dft

FFT : DEFINATION

FFT is the algorithm that efficiently computes the DFT.

In applying FFT, the DFT expression can be written as :

X(k) = WNnk , k = 0, 1,…,N-1

where, WN = e-j2/N

1

0

)(N

n

nx

Page 25: Dft

IFFT : DEFINATION

The FFT for IDFT can be defined as:

x(n) = 1/N WNnk

WWNN2 2 = (e= (e-j2-j2/N/N))2 2 = e= e-j2-j22/N2/N = W = WN/2N/2

1

0

)(N

k

kX

Page 26: Dft

DFT & IDFT : SUMMARY

The DFT & IDFT can be summarized below: 1. It is a powerful method to perform frequency analysis which are used widely in digital image processing including blurring and enhancing. 2. Since the DFT & IDFT will become tedious when the length of the sequence become big, one algorithm is develop to overcome this problem. 3. The algorithm can be found in MATLAB. The function are : 1. FFT2 = to perform DFT 2. IFFT2 = to perform IDFT

Page 27: Dft

Ex5.2 DFS of square wave seq.

Note

1. Envelope like the sinc function;

2. Zeros occur at N/L (reciprocal of duty cycle);

3. Relation of N to density of freq. Samples;

)/sin(

)/sin(

,2,,0,

)(~

/)1(

Nk

NkLe

NNkL

kX NLj

Page 28: Dft

Relation to the z-transform

1

0

)()(elsewhere,0

10,Nonzero)(

N

n

nznxzXNn

nx

1

0

2

)()(~

elsewhere,0

10),(~)(

N

n

nkj NenxkXNnnx

nx

kN

jez

zXkX 2|)()(~

The DFS X(k) represents N evenly spaced samples of the z-transform X(z) around the unit circle.

Page 29: Dft

Relation to the DTFT

kwjw

N

n

jwnN

n

jwnjw

NeXkX

enxenxeX

2|)()(~

)(~)()(1

0

1

0

)()()(

2,

2

1

11

jkwjw

k

eXeXkX

kwkN

wandN

wLet

k

The DFS is obtained by evenly sampling the DTFT at w1 intervals.

The interval w1 is the sampling interval in the frequency domain. It is called frequency resolution because it tells us how close are the frequency samples.

Page 30: Dft

Sampling and construction in the z-domain

m

kmN

m

kmj

ez

Wmxemx

kzXkX

N

kN

j

)()(

,2,1,0,|)()(~

2

2

rm r

m rm

N

k

mnkN

N

k

knN

m

kmN

N

k

knN

rNnxrNmnmx

rNmnmxWN

mx

WWmxN

WkXN

nx

)()()(

)()(1

)(

)(1

)(~1

)(~

1

0

)(

1

0

1

0

DFS & z-transform

IDFS

Page 31: Dft

Comments

When we sample X(z) on the unit circle, we obtain a periodic sequence in the time domain.

This sequence is a linear combination of the original x(n) and its infinite replicas, each shifted by multiples of N or –N.

If x(n)=0 for n<0 and n>=N, then there will be no overlap or aliasing in the time domain.

Page 32: Dft

Comments

else

NnnxnRnxnx

Nnfornxnx

N 0

101)(~)()(~)(

10)(~)(

RN(n) is called a rectangular window of length N.

THEOREM1: Frequency Sampling

If x(n) is time-limited (finite duration) to [0,N-1], then N samples of X(z) on the unit circle determine X(z) for all z.

Page 33: Dft

Reconstruction FormulaLet x(n) be time-limited to [0,N-1]. Then from Theorem 1 we should be able to recover the z-transform X(z) using its samples X~(k).

1

01

1

0

1

0

11

0

1

0

1

0

1

0

1

0

1

0

1

1)(

~1

)(~1

)(~1

)(~1

)(~)()(

N

kk

N

NkNN

N

k

N

n

nkN

N

k

N

n

nknN

N

n

nN

k

knN

N

n

nN

n

n

zW

zWkX

N

zWkXN

zWkXN

zWkXN

znxznxzX

WN-kN=1

1

011

)(~

1)(

N

kk

N

N

zW

kX

N

zzX

Page 34: Dft

The DTFT Interpolation Formula

1

0/2

1

0/2 1

1)(

~

1

)(~

1)(

N

kjwNkj

jwNN

kjwNkj

jwNjw

eeN

ekX

ee

kX

N

eeX

21

2

2

sin

sin)(

Njw

w

wN

eN

w An interpolation polynomial

1

0

2)(~

)(N

kN

kjw wkXeX This is the DTFT interpolation formula to reconstruct X(ejw) from its samples X~(k)

Since , we have that X(ej2pik/N)=X~(k), which means that the interpolation is exact at sampling points.

1)0(

Page 35: Dft

The Discrete Fourier Transform The discrete Fourier series provided us a mechanism

for numerically computing the discrete-time Fourier transform.

It also alert us to a potential problem of aliasing in the time domain.

Mathematics dictates that the sampling of the discrete-time Fourier transform result in a periodic sequences x~(n).

But most of the signals in practice are not periodic. They are likely to be of finite duration.

Page 36: Dft

The Discrete Fourier Transform Theoretically, we can take care of this problem by

defining a periodic signal whose primary shape is that of the finite duration signal and then using the DFS on this periodic signal.

Practically, we define a new transform called the Discrete Fourier Transform (DFT), which is the primary period of the DFS.

This DFT is the ultimate numerically computable Fourier transform for arbitrary finite duration sequences.

Page 37: Dft

The Discrete Fourier Transform First we define a finite-duration sequence x(n) that has N

samples over 0<=n<=N as an N-point sequence

Nr

nxNnxnxrNnxnx ))(()mod()(~)()(~

The compact relationships between x(n) and x~(n) are

)()()(~)(

)())(()(~

operationWindownRnxnx

extensionPeriodicnxnx

N

N

The function rem(n,N) can be used to implement our modulo-N operation.

Page 38: Dft

The Discrete Fourier Transform The Discrete Fourier Transform of an N-point sequence is

given by

10,)()(

)()(~

0

10)(~

)]([)(

1

0

NkWnxkX

nRkXelse

NkkXnxDFTkX

N

n

nkN

N

Note that the DFT X(k) is also an N-point sequence, that is, it is not defined outside of 0<=n<=N-1.

DFT X(k) is the primary interval of X~(k).

10,)(1

)()(~)]([)(1

0

NnWkXN

nRnxkXIDFTnxN

k

knNN

Page 39: Dft

Matlab Implementation

XWN

x

xWX

N

N

*1

2)1()1(

)1(1

1

1

111

1,0

NN

NN

NNNkn

NN

WW

WWNnkWW

Page 40: Dft

Zero-padding is an operation in which more zeros are appended to the original sequence. The resulting longer DFT provides closely spaced samples of the discrete-times Fourier transform of the original sequence.

The zero-padding gives us a high-density spectrum and provides a better displayed version for plotting. But it does not give us a high-resolution spectrum because no new information is added to the signal; only additional zeros are added in the data.

To get high-resolution spectrum, one has to obtain more data from the experiment or observations.

Page 41: Dft

Properties of the DFT

1. Linearity: DFT[ax1(n)+bx2(n)]=aDFT[x1(n)]+bDFT[x2(n)]

N3=max(N1,N2): N3-point DFT

2. Circular folding:

11)(

0)0())((]))(([

11)(

0)0())((

NkkNX

kXkXnxDFT

NkkNx

kxnx

NN

N

Matlab: x=x(mod(-n,N)+1)

Page 42: Dft

Properties of the DFT

3. Conjugation: NkXnxDFT ))(()]([ **

4. Symmetry properties for real sequences:

Let x(n) be a real-valued N-point sequence

NkXkX ))(()( *

N

N

N

N

kXkX

kXkX

sequenceoddcircularkNXkX

sequenceevencircularkXkX

))(()(

|))((||)(|

:]))((Im[)](Im[

:]))((Re[)](Re[

Page 43: Dft

Comments: Circular symmetry Periodic conjugate symmetry About 50% savings in computation as well as in storage. X(0) is a real number: the DC frequency X(N/2)(N is even) is also real-valued: Nyquist component Circular-even and circular-odd components:

]))(()([2

1)(

]))(()([2

1)(

Noc

Nec

nxnxnx

nxnxnx

The real-valued signals

]))((Im[)](Im[)]([

]))((Re[)](Re[)]([

Noc

Nec

kXkXnxDFT

kXkXnxDFT

Function, p143

Page 44: Dft

Properties

5. Circular shift of a sequence

)()]())(([ kXWnRmnxDFT kmNNN

6. Circular shift in the frequency domain

)())(()]([ kRlkXnxWDFT NNnl

N

7. Circular convolution**

10,))(()()()(1

02121

Nnmnxmxnxnx

N

mN

)()()]()([ 2121 kXkXnxnxDFT

Page 45: Dft

Properties

8. Multiplication: )()(1

)]()([ 2121 kXkXN

nxnxDFT

9. Parseval’s relation:

1

0

21

0

2 |)(|1

|)(|N

k

N

nx kX

NnxE

Energy spectrum

Power spectrum 2

2

)(

|)(|

N

kX

N

kX

Page 46: Dft

Linear convolution using the DFT

In general, the circular convolution is an aliased version of the linear convolution.

If we make both x1(n) and x2(n) N=N1+N2-1 point sequences by padding an appropriate number of zeros, then the circular convolution is identical to the linear convolution.

)()()()()(

)()()(

)())(()()()()(

3

1

021

1

021

1

021214

1

nRrNnxnRrNknxkx

nRrNknxkx

nRknxkxnxnxnx

Nr

Nr

N

m

N

N

m r

N

N

mN

Page 47: Dft

Error Analysis When N=max(N1,N2) is chosen for circular convolution, then

the first (M-1) samples are in error, where M=min(N1,N2).

10)(

)()]()([)(

),max()()(

)()()()(

3

33

210

3

3334

NnNnx

nRNnxNnxne

NNNnRrNnx

nxnRrNnxxxne

N

Nr

Nr

X3(n) is also causal n=0,1,…(N1+N2-1)-N

Page 48: Dft

Block Convolution Segment the infinite-length input sequence into smaller sections (or blocks),

process each section using the DFT, and finally assemble the output

sequence from the outputs of each section. This procedure is called a block

convolution operation.

Let us assume that the sequence x(n) is sectioned into N-point sequence and

that the impulse response of the filter is an M-point sequence, where M<N.

We partition x(n) into sections, each overlapping with the previous one by

exactly (M-1) samples, save at last (N-M+1) output samples, and finally

concatenate these outputs into sequence.

To correct for the first (M-1) samples in the first output block, we set the

first (M-1) samples in the first input blocks to zero.

Page 49: Dft

The Fast Fourier Transform Although the DFT is computable transform, the

straightforward implementation is very inefficient, especially when the sequence length N is large.

In 1965, Cooley and Tukey showed the a procedure to substantially reduce the amount of computations involved in the DFT.

This led to the explosion of applications of the DFT. All these efficient algorithms are collectively known

as fast Fourier transform (FFT) algorithms.

Page 50: Dft

The FFT Using the Matrix-vector multiplication to

implement DFT: X=WNx (WN: N*N, x: 1*N, X: 1*N) takes N×N multiplications and (N-1)×N

additions of complex number.

Number of complex mult. CN=O(N2) A complex multiplication requires 4 real

multiplications and 2 real additions.

Page 51: Dft

Goal of an Efficient computation The total number of computations should be linear

rather than quadratic with respect to N. Most of the computations can be eliminated using the

symmetry and periodicity properties

CN=N×log2N

If N=2^10, CN=will reduce to 1/100 times.

knN

NknN

nNkN

NnkN

knN

WW

WWW

2/

)()(

Decimation-in-time: DIT-FFT, decimation-in-frequency: DIF-FFT

Page 52: Dft

4-point DFT→FFT example

X=Wx X(0) = x(0)+x(2) + x(1)+x(3) = g1 + g2 X(1) = x(0)-x(2) – j(x(1)-x(3)) = h1 - jh2 X(2) = x(0)+x(2) - x(1)+x(3) = g1 - g2 X(3) = x(0)-x(2) + j(x(1)-x(3)) = h1 + jh2 It requires only 2 complex multiplications. Signal flowgraph

3

0

4/244 ;30,)()(

n

jnk jeWkWnxkX

jWWW

jWWWW

3

46

42

4

94

14

44

04

;1

;1Efficient Approach

Page 53: Dft

A 4-point DFT→FFT example

neededationmultiplicnoWAorAWso

WW

WWWwhere

Wxx

xxW

j

Whh

gg

jW

jhh

gg

XX

XX

22

1*12

0*12

1*02

0*02

2

22

221

212

21

21

**

11

11

*)3()2(

)1()0(**.

1

11

**.1

11*

)3()2(

)1()0(

Page 54: Dft

Divide-and-combine approach To reduce the DFT computation’s quadratic dependence on N,

one must choose a composite number N=LM since L2+M2<<N2 for large N.

Now divide the sequence into M smaller sequences of length L, take M smaller L-point DFTs, and combine these into a large DFT using L smaller M-point DFTs. This is the essence of the divide-and-combine approach.

10,10,

10,10,

MqLpLqpk

MmLlmMln

Page 55: Dft

Divide-and-combine approach

DFTpoM

M

m

mqM

DFTpoL

L

l

lpL

mpN

M

m

LmqN

L

l

MlpN

mpN

M

m

L

l

LqpmMlN

WWmlxW

WWmlxW

WmlxqpX

int

1

0

int

1

0

1

0

1

0

1

0

1

0

))((

),(

),(

),(),(

Three-step procedure: P155

Twiddle factor

Page 56: Dft

Divide-and-combine approach

The total number of complex multiplications for this approach can now be given by

CN=ML2+N+LM2<o(N2) This procedure can be further repeat if M or L

are composite numbers. When N=Rv, then such algorithms are called

radix-R FFT algorithms.

Page 57: Dft

A 8-point DFT→FFT example 1. two 4-point DFT for m=1,2

)1,3()0,3(

)1,2()0,2(

)1,1()0,1(

)1,0()0,0(

*),(

),(),(

334

234

134

034

324

224

124

024

314

214

114

014

304

204

104

004

3

0

2

1

0

3

048

xx

xx

xx

xx

WWWW

WWWW

WWWW

WWWW

mpF

WmlxWWqpX

l

mq

m l

plpm

Page 58: Dft

112

012

102

002

2

1

08

8

*

)1,3()0,3(

)1,2()0,2(

)1,1()0,1(

)1,0()0,0(

),(),(

2.3

8.24

),(),(.2

WW

WW

GG

GG

GG

GG

WmpFWqp

withDFTXntpoi

multnscplxofmultdotmatrixais

mpFWmpG

mq

m

pm

pm

Page 59: Dft

Number of multiplications

A 4-point DFT is divided into two 2-point DFTs, with one intermedium matrix mult.

number of multiplications=

4×4cplx→ 2 ×1+ 1 ×4 cplx 16 →6 A 8-point DFT is divided into two 4-point

DFTs, with one intermedium matrix mult. 8×8→2 ×6 + 2×4 64 →20

For 16-point DFT: 16×16→2 ×20 + 2×8 256 →56

Page 60: Dft

Radix-2 FFT Algorithms Let N=2v; then we choose M=2 and L=N/2 and divide x(n) into

two N/2-point sequence. This procedure can be repeated again and again. At each stage

the sequences are decimated and the smaller DFTs combined. This decimation ands after v stages when we have N one-point sequences, which are also one-point DFTs.

The resulting procedure is called the decimation-in-time FFT (DIF-FFT) algorithm, for which the total number of complex multiplications is: CN=Nv= N*log2N;

using additional symmetries: CN=Nv= N/2*log2N Signal flowgraph in Figure 5.19

Page 61: Dft

Decimation-in-frequency FFT In an alternate approach we choose L=2, M=N/2 and

follow the steps in (5.49). We can get the decimation-frequency FFT (DIF-FFT)

algorithm. Its signal flowgraph is a transposed structure of the

DIT-FFT structure. Its computational complexity is also equal to CN=Nv=

N/2*log2N

Page 62: Dft

Matlab Implementation Function: X = fft(x,N)

If length(x)<N, x is padded with zeros. If the argument N is omitted, N=length(x) If x is matrix, fft computes the N-point DFT of each

column of x It is written in machine languag and not use the

Matlab command. Therefore, it executes very fast. It is written as a mixed-radix algorithm.

N=2v; N=prime number, it is reduced to the raw DFT.

Page 63: Dft

Fast Convolutions Use the circular convolution to implement the linear

convolution and the FFT to implement the circular convolution.

The resulting algorithm is called a fast convolution algorithm. If we choose N=2v and implement the radix-2 FFT, then the

algorithm is called a high-speed convolution. If x1(n) is N1-point, x2(n) is N2-point, then

Compare the linear convolution and the high-speed conv.

)1(log 2122 NNN

Page 64: Dft

High-speed Block Convolution

Overlap-and-save method We can now replace the DFT by the radix-2

FFT algorithm to obtain a high-speed overlap-and-save algorithm.

Page 65: Dft

Discrete Fourier transform

DFT

110 ,...,, Nxxx

110 ,...,, NXXX

1

0

2N

i

ikN

j

ik exX

Maps a set of input points to another set of output points.The operation is reversible.

Page 66: Dft

Roots of the unity

real

imaginary

(1, 0)

(0, j)

(-1, 0)

(0, -j)

• What are the Nth roots of unity? If N = 8 then we have

78

26

8

2

58

24

8

2

38

22

8

2

18

20

8

2

,

,

,

,

jj

jj

jj

jj

ee

ee

ee

ee

Define Nj

N eW2

Page 67: Dft

Calculating the DFT

1

0

1

0

2 N

i

iki

N

i

ikN

j

ik NWxexX

1

3

2

1

0

321

3963

2642

1321

1

3

2

1

0

.

...1

...

...1

...1

...1

1...1111

...

NN

NN

NN

N

NNNNN

NNNNN

NNNNN

N x

x

x

x

x

WWWW

WWWW

WWWW

WWWW

X

X

X

XX

How many arithmetic (+ and *) operations do we need to calculate the DFT?

Page 68: Dft

Computing the DFT using the FFT How can we do better? Fast Fourier Transform (FFT)

ok

kN

ekk

N

i

N

ikj

ik

N

N

i

N

ikj

ik

N

kjN

i

N

ikj

i

N

i

N

ikj

ik

N

i

N

kij

i

N

i

N

kij

ik

N

i

ikN

j

ik

XWXX

exWexX

eexexX

exexX

exX

12/

0

2/

2

12

12/

0

2/

2

2

212/

0

2/

2

12

12/

0

2/

2

2

12/

0

)12(2

12

12/

0

)2(2

2

1

0

2

DFT of even indices

DFT of odd indicesThe sum of N point DFT has been broken into two N/2 point DFTs

Page 69: Dft

Example when N=8Objective: Compute X0, X1, … X7 given x0, x1, …, x7

magic box

magic box

x0

x2

x4

x6

x1

x3

x5

x7

eX 0eX1eX 2eX 3

oX 0oX1oX 2

oX 3

18W

08W

X0

28W

38W4

8W5

8W6

8W

78W

X1

X2

X3

X4

X5

X6

X7

kN

NkN WW 2/Note

that

Page 70: Dft

Now let’s apply the idea recursively

x0

x4

x2

x6

x1

x5

x3

x7

eX 0eX1eX 2

eX 3

oX 0oX1

oX 2

oX 3

18W

08W

X0

28W

38W4

8W5

8W6

8W

78W

X1

X2

X3

X4

X5

X6

X7

eeX 0eeX1

eoX 0eoX1

oeX 0oeX1

ooX 0ooX1

04W

14W

24W

34W

04W

14W

24W

34W

Page 71: Dft

One more timex0

x4

x2

x6

x1

x5

x3

x7

eX 0eX1eX 2

eX 3

oX 0oX1

oX 2

oX 3

18W

08W

X0

28W

38W4

8W5

8W6

8W

78W

X1

X2

X3

X4

X5

X6

X7

eeX 0

eeX1

eoX 0

eoX1oeX 0

oeX1ooX 0

ooX1

04W

14W

24W

34W

04W

14W

24W

34W

• How many operations do we need now?• What is the execution time on a general purpose CPU?• What is the execution time on a FPGA? How many resources u need?

Page 72: Dft

Another way to visualize FFT computations

How can we determine the order of the first inputs?

x0

x4

x2

x6

x1

x5

x3

x7

Butterfly

Butterfly

Butterfly

Butterfly

ButterflyButterfly

ButterflyButterfly

ButterflyButterfly

ButterflyButterfly

X0

X4

X1

X5

X2

X6

X3

X7

Page 73: Dft

Savings so far … We have split the DFT computation into two halves:

Have we gained anything? Consider the nominal number of multiplications for Original form produces multiplications New form produces multiplications So we’re already ahead ….. Let’s keep going!!

X[k] k0

N 1

x[n]WNnk

n0

(N/ 2) 1

x[2r]WN /2rk WN

k

n0

(N/ 2) 1

x[2r 1]WN / 2rk

N 8

2(42 ) 8 4082 64

Page 74: Dft

Signal flowgraph notation In generalizing this formulation, it is most convenient to adopt a graphic

approach … Signal flowgraph notation describes the three basic DSP operations:

Addition

Multiplication by a constant

Delay

x[n]

y[n]x[n]+y[n]

x[n]

aax[n]

x[n] x[n-1]z-1

Page 75: Dft

Signal flowgraph representation of 8-point DFT Recall that the DFT is now of the form The DFT in (partial) flowgraph notation:

X[k] G[k] WNk H[k]

Page 76: Dft

Continuing with the decomposition … So why not break up into additional DFTs? Let’s take the

upper 4-point DFT and break it up into two 2-point DFTs:

Page 77: Dft

The complete decomposition into 2-point DFTs

Page 78: Dft

Now let’s take a closer look at the 2-point DFT The expression for the 2-point DFT is:

Evaluating for we obtain

which in signal flowgraph notation looks like ...

X[k] n0

1

x[n]W2nk

n0

1

x[n]e j2nk / 2

k 0,1

X[0] x[0] x[1]

X[1] x[0] e j21/ 2x[1] x[0] x[1]

This topology is referred to as thebasic butterfly

Page 79: Dft

The complete 8-point decimation-in-time FFT

Page 80: Dft

Number of multiplys for N-point FFTs

Let (log2(N) columns)(N/2 butterflys/column)(2 mults/butterfly)

or ~ multiplys

N 2 where log2 (N)

N log2(N)

Page 81: Dft

“Slow” DFT requires N mults; FFT requires N log2(N) mults

Filtering using FFTs requires 3(N log2(N))+2N mults Let

N 1 2

16 .25 .8124

32 .156 .50

64 .0935 .297

128 .055 .171

256 .031 .097

1024 .0097 .0302

Comparing processing with and without FFTs

Note: 1024-point FFTs accomplish speedups of 100for filtering, 30 for DFTs!

1 N log2 (N) / N2 ; 2 [3(N log2 (N)) N] / N 2

Page 82: Dft

Additional timesavers: reducing multiplications in the basic butterfly

As we derived it, the basic butterfly is of the form

Since we can reducing computation by 2 by premultiplying by

WNN / 2 1

WNr

WNr

WNrN / 2

WNr

1

1

Page 83: Dft

Consider the binary representation of theindices of the input:

0 0004 1002 0106 1101 0015 1013 0117 111

Bit reversal of the input first stages of the 8-point FFT:

If these binary indices are time reversed, we get the binary sequence representing 0,1,2,3,4,5,6,7

Hence the indices of the FFTinputs are said to be in bit-reversed order

Page 84: Dft

Some comments on bit reversal In the implementation of the FFT that we discussed, the input is bit

reversed and the output is developed in natural order Some other implementations of the FFT have the input in natural order

and the output bit reversed (to be described Thursday) In some situations it is convenient to implement filtering applications

by Use FFTs with input in natural order, output in bit-reversed order Multiply frequency coefficients together (in bit-reversed order) Use inverse FFTs with input in bit-reversed order, output in

natural order Computing in this fashion means we never have to compute bit

reversal explicitly