# OpenStax_CNX

You are here: Home » Content » The FFT Algorithm

### Recently Viewed

This feature requires Javascript to be enabled.

### Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

# The FFT Algorithm

Module by: Robert Nowak. E-mail the author

Summary: The FFT, an efficient way to compute the DFT, is introduced and derived throuhgout this module.

Note: You are viewing an old version of this document. The latest version is available here.

Definition 1: FFT
(Fast Fourier Transform) An efficient computational algorithm for computing the DFT.

## The Fast Fourier Transform FFT

DFT can be expensive to compute directly k,0kN1:Xk=n=0N1xne(i2πkNn) k 0 k N 1 X k n 0 N 1 x n 2 k N n

For each kk, we must execute:

• NN complex multiplies
• N1 N 1 complex adds
The total cost of direct computation of an NN-point DFT is
• N2 N 2 complex multiplies
• N(N1) N N 1 complex adds
How many adds and mults of real numbers are required?

This " ON2 O N 2 " computation rapidly gets out of hand, as NN gets large:

 NN 1 10 100 1000 106 106 N2 N2 1 100 10,000 106 106 1012 1012

The FFT provies us with a much more efficient way of computing the DFT. The FFT requires only " ONlogN O N N " computations to compute the NN-point DFT.

 NN 10 100 1000 106 106 N2 N2 100 10,000 106 106 1012 1012 N⁢logN N 10 N 10 200 3000 6×106 66

How long is 1012μsec 10 12 μsec ? More than 10 days! How long is 6×106μsec 66 μsec ?

The FFT and digital computers revolutionized DSP (1960 - 1980).

## How does the FFT work?

• The FFT exploits the symmetries of the complex exponentials WN kn=e(i2πNkn) WN k n 2 N k n
• WN kn WN k n are called "twiddle factors"

### Symmetry 1: Complex Conjugate Symmetry

WN k(Nn)= WN (kn)= WN kn¯ WN k N n WN k n WN k n e(i2πkN(Nn))=ei2πkNn=e(i2πkNn)¯ 2 k N N n 2 k N n 2 k N n

### Symmetry 2: Periodicity in n and k

WN kn= WN k(N+n)= WN (k+N)n WN k n WN k N n WN k N n e(i2πNkn)=e(i2πNk(N+n))=e(i2πN(k+N)n) 2 N k n 2 N k N n 2 N k N n WN =e(i2πN) WN 2 N

## Decimation in Time FFT

• Just one of many different FFT algorithms
• The idea is to build a DFT out of smaller and smaller DFTs by decomposing xn x n into smaller and smaller subsequences.
• Assume N=2m N 2 m (a power of 2)

### Derivation

NN is even, so we can complete Xk X k by separating xn x n into two subsequences each of length N2 N 2 . xn{N2  if  n=evenN2  if  n=odd x n N 2 n even N 2 n odd k,0kN1:Xk=n=0N1xn WN kn k 0 k N 1 X k n 0 N 1 x n WN k n Xk=n=2rxn WN kn+n=2r+1xn WN kn X k n 2 r x n WN k n n 2 r 1 x n WN k n where 0rN21 0 r N 2 1 . So

Xk=r=0N21x2r WN 2kr+r=0N21x2r+1 WN (2r+1)k=r=0N21x2r WN 2kr+ WN kr=0N21x2r+1 WN 2kr X k r 0 N 2 1 x 2 r WN 2 k r r 0 N 2 1 x 2 r 1 WN 2 r 1 k r 0 N 2 1 x 2 r WN 2 k r WN k r 0 N 2 1 x 2 r 1 WN 2 k r
(1)
where WN 2=e(i2πN2)=e(i2πN2)= W N 2 WN 2 2 N 2 2 N 2 W N 2 . So Xk=r=0N21x2r W N 2 kr+ WN kr=0N21x2r+1 W N 2 kr X k r 0 N 2 1 x 2 r W N 2 k r WN k r 0 N 2 1 x 2 r 1 W N 2 k r where r=0N21x2r W N 2 kr r 0 N 2 1 x 2 r W N 2 k r is N2 N 2 -point DFT of even samples ( Gk G k ) and r=0N21x2r+1 W N 2 kr r 0 N 2 1 x 2 r 1 W N 2 k r is N2 N 2 -point DFT of odd samples ( Hk H k ). k,0kN1:Xk=Gk+ WN kHk k 0 k N 1 X k G k WN k H k Decomposition of an NN-point DFT as a sum of 2 N2 N 2 -point DFTs.

Why would we want to do this? Because it is more efficient!

#### Recall:

Cost to compute an NN-point DFT is approximately N2 N 2 complex mults and adds.
But decomposition into 2 N2 N 2 -point DFTs + combination requires only N22+N22+N=N22+N N 2 2 N 2 2 N N 2 2 N where the first part is the number of complex mults and adds for N2 N 2 -point DFT, Gk G k . The second part is the number of complex mults and adds for N2 N 2 -point DFT, Hk H k . The third part is the number of complex mults and adds for combination. And the total is N22+N N 2 2 N complex mults and adds.

#### Example 1: Savings

For N=1000 N 1000 , N2=106 N 2 10 6 N22+N=1062+1000 N 2 2 N 10 6 2 1000 Because 1000 is small compared to 500,000, N22+N1062 N 2 2 N 10 6 2

So why stop here?! Keep decomposing. Break each of the N2 N 2 -point DFTs into two N4 N 4 -point DFTs, etc, ....

We can keep decomposing: N21=N2N4N8N2m1N2m=1 N 2 1 N 2 N 4 N 8 N 2 m 1 N 2 m 1 where m=log2N= times m 2 N  times

Computational cost: N N-pt DFT  two N2 N 2 -pt DFTs. The cost is N22N22+N N 2 2 N 2 2 N . So replacing each N2 N 2 -pt DFT with two N4 N 4 -pt DFTs will reduce cost to 2(2N42+N2)+N=4N42+2N=N222+2N=N22p+pN 2 2 N 4 2 N 2 N 4 N 4 2 2 N N 2 2 2 2 N N 2 2 p p N As we keep going p=34m p 3 4 m , where m=log2N m 2 N . We get the cost N22log2N+Nlog2N=N2N+Nlog2N=N+Nlog2N N 2 2 2 N N 2 N N 2 N N 2 N N N 2 N N+Nlog2N N N 2 N is the total number of complex adds and mults.

For large NN, costNlog2N cost N 2 N or " ONlog2N O N 2 N ", since Nlog2NN N 2 N N for large NN.

### Note:

Weird order of time samples

## Content actions

### Give feedback:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks