Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 19

EXPERT SYSTEMS AND SOLUTIONS

Email: expertsyssol@gmail.com
expertsyssol@yahoo.com
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.
Fast Fourier Transform
(FFT)
Outline
 Purpose
 Background
 Fourier Transform
 Continuous Fourier Transform
 Discrete Fourier Transform (DFT)
 Fast Fourier Transform (FFT)
 FFTW
 Examples
Purpose
 Analyze the frequencies contained in a
sampled signal
 Used in:
 Digital Signal Processing
 Optics
 Oceanography
 Acoustics
 Physics
 Number Theory
Fourier Transform
 Named after Jean Baptiste Joseph Fourier
 an integral transform that re-expresses a
function in terms of sinusoidal basis functions
 transforms linear differential equations with
constant coefficients into ordinary algebraic
ones
 turns the complicated convolution operation
into simple multiplication
Continuous Fourier Transform
 decomposes a function into a continuous
spectrum of the frequencies that comprise that
function
 Function:

 Inverse:
Discrete Fourier Transform
 Also called Finite Fourier Transform
 The n complex numbers x0, ..., xn-1 (ie. xi=xreal + i*ximag)
are transformed into the n complex numbers f0, ..., fn-1
according to the formula:

 Inverse (IDFT)
DFT cont.
Written in matrix form, the DFT is:

where
Fast Fourier Transform (FFT)
 An efficient algorithm to compute the DFT and its
inverse
 Divide and conquer algorithm
 Reduces time from O(n2) to O(n log n)
 Seismic Data contains hundreds of thousands of
samples and would take months to evaluate the DFT
 Cooley-Tukey is most popular implementation
 Developed in 1965
 Re-invented work done by Carl F. Gauss in 1805
FFT Definitions
 sinusoid
the curve of y=sin x
 radix
the size of an FFT decomposition.
 twiddle factors
the coefficients used to combine results from a previous
stage to form inputs to the next stage.
 “in place” FFT
an FFT that is calculated entirely inside its original sample
memory.
FFT Definitions cont.
 bit reversal
0, 1, 2, 3, 4, 5, 6, 7 is reordered to 0, 4, 2, 6, 1, 5, 3, 7
Decimal Binary Binary Decimal
0 000 000 0
1 001 100 4
2 010 010 2
3 011 110 6
4 100 001 1
5 101 101 5
6 110 011 3
7 111 111 7
FFT Implementation
 Radix-2
 N, the sample size, must be a power of 2

 Mixed-radix
 Can use different powers at different stages
 Ex. 1000 = 2*2*2*5*5*5 (six stages) or
1000 = 10 * 10 * 10 (three stages)
FFT Implementation (cont.)
1. Pad input sequence, of N samples, with ZERO's until the
number of samples is the nearest power of two.
e.g. 500 samples are padded to 512 (2^9)
2. Bit reverse the input sequence.
e.g. 3 = 011 goes to 110 = 6
3. Compute (N / 2) two sample DFT's from the shuffled inputs.
4. Compute (N / 4) four sample DFT's from the two sample
DFT's.
5. Compute (N / 2) eight sample DFT's from the four sample
DFT's.
...
6. Combine back into one N-sample DFT
Fast Fourier Transform in the West
(FFTW)
 Developed at MIT
 Free collection of fast C routines for
computing the DFT in 1 or more dimensions
 Includes complex, real, symmetric, and
parallel transforms
 MPI parallel transforms are only available in
v. 2.1.5
FFTW cont.
 Serial/Parallel, Share/Distributed Memory

 Faster than most “non-free” implementations

 Portable, automatically adapt to machine


Two Phases of FFTW
 Hardware dependent algorithm
 Planner
 ‘Learn’ the fast way on your machine
 Produce a data structure --‘plan’
 Reusable
 Executor
 Compute the transform
 Apply to all FFTw operation modes
 1D/nD, complex/real, serial/parallel
MPI FFTW Routines
 fftwnd_mpi_plan fftwnd_create_plan(mpi_comm comm,
int rank, const *int n, fftw_direction dir, int flags);

 void fftwnd_mpi_local_size(fftwnd_mpi_plan p,
int *local_first, int *local_first_start,
int *local_second_after_transpose,
int *local_second_start_after_transpose,
int *total_local_size);

 local_data = (fftw_complex*) malloc(sizeof(fftw_complex)


* total_local_size);

 work = (fftw_complex*) malloc(sizeof(fftw_complex)


* total_local_size);

 void fftwnd_mpi(fftwnd_mpi_plan p, int n_fields,


fftw_complex *local_data, fftw_complex *work,
fftw_mpi_output_order output_order);

 void fftw_mpi_destroy_plan(fftwnd_mpi_plan p
Examples
 View C source code
fftw_mpi.c
fftw_mpi_test.c
 To compile:
cc -o ffmpi fftw_mpi_test.c –lmpi -lfftw_mpi -lfftw –lm
 Matlab Example
References
 http://en.wikipedia.org/wiki/Fourier_transform
 http://en.wikipedia.org/wiki/Continuous_Fourier_transform
 http://en.wikipedia.org/wiki/Discrete_Fourier_transform
 http://astonomy.swin.edu.au/~pbourke/analysis/dft
 http://www.dspguru.com/info/faqs/fftfaq.htm
 http://www.arc.unm.edu/~gbma/Workshop/FFTW/slides/outlinee.htm
 http://astron.berkeley.edu/~jrg/ngst/fft/fourier.html
 http://www.spd.eee.strath.ac.uk/~interact/fourier/fft/fftalgrm.html
 http://www.ni.com/swf/presentation/us/fft/
 http://www.fftw.org

You might also like