Upload
senthil-kumar
View
678
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
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.
Fast Fourier TransformFast Fourier Transform(FFT)(FFT)
OutlineOutline
PurposePurpose BackgroundBackground
Fourier TransformFourier Transform Continuous Fourier TransformContinuous Fourier Transform Discrete Fourier Transform (DFT)Discrete Fourier Transform (DFT)
Fast Fourier Transform (FFT)Fast Fourier Transform (FFT) FFTWFFTW ExamplesExamples
PurposePurpose
Analyze the frequencies contained in a Analyze the frequencies contained in a sampled signalsampled signal
Used in:Used in: Digital Signal ProcessingDigital Signal Processing OpticsOptics OceanographyOceanography AcousticsAcoustics PhysicsPhysics Number TheoryNumber Theory
Fourier TransformFourier Transform
Named after Jean Baptiste Joseph FourierNamed after Jean Baptiste Joseph Fourier an integral transform that re-expresses a an integral transform that re-expresses a
function in terms of sinusoidal basis functionsfunction in terms of sinusoidal basis functions transforms linear differential equations with transforms linear differential equations with
constant coefficients into ordinary algebraic constant coefficients into ordinary algebraic onesones
turns the complicated convolution operation turns the complicated convolution operation into simple multiplicationinto simple multiplication
Continuous Fourier TransformContinuous Fourier Transform
decomposes a function into a continuous decomposes a function into a continuous spectrum of the frequencies that comprise that spectrum of the frequencies that comprise that function function
Function:Function:
Inverse:Inverse:
Discrete Fourier TransformDiscrete Fourier Transform
Also called Finite Fourier TransformAlso called Finite Fourier Transform The The nn complex numbers complex numbers xx00, ..., , ..., xxnn-1-1 (ie. x (ie. xii=x=xrealreal + i*x + i*ximagimag))
are transformed into the are transformed into the nn complex numbers complex numbers ff00, ..., , ..., ffnn-1-1
according to the formula:according to the formula:
Inverse (IDFT)Inverse (IDFT)
DFT cont.DFT cont.
Written in matrix form, the DFT is:Written in matrix form, the DFT is:
wherewhere
Fast Fourier Transform (FFT)Fast Fourier Transform (FFT)
An efficient algorithm to compute the DFT and its An efficient algorithm to compute the DFT and its inverseinverse
Divide and conquer algorithmDivide and conquer algorithm Reduces time from O(nReduces time from O(n22) to O(n log n)) to O(n log n) Seismic Data contains hundreds of thousands of Seismic Data contains hundreds of thousands of
samples and would take months to evaluate the DFTsamples and would take months to evaluate the DFT Cooley-Tukey is most popular implementationCooley-Tukey is most popular implementation
Developed in 1965Developed in 1965 Re-invented work done by Carl F. Gauss in 1805Re-invented work done by Carl F. Gauss in 1805
FFT DefinitionsFFT Definitions
sinusoidsinusoid the curve of y=sin x the curve of y=sin x
radixradixthe size of an FFT decomposition.the size of an FFT decomposition.
twiddle factorstwiddle factorsthe coefficients used to combine results from a previous the coefficients used to combine results from a previous stage to form inputs to the next stage.stage to form inputs to the next stage.
““in place” FFTin place” FFTan FFT that is calculated entirely inside its original sample an FFT that is calculated entirely inside its original sample memory. memory.
FFT Definitions cont.FFT Definitions cont. bit reversalbit reversal
0, 1, 2, 3, 4, 5, 6, 70, 1, 2, 3, 4, 5, 6, 7 is reordered to is reordered to 0, 4, 2, 6, 1, 5, 3, 70, 4, 2, 6, 1, 5, 3, 7
DecimalDecimal BinaryBinary BinaryBinary DecimalDecimal
00 000000 000000 00
11 001001 100100 4422 010010 010010 22
33 011011 110110 6644 100100 001001 1155 101101 101101 5566 110110 011011 3377 111111 111111 77
FFT ImplementationFFT Implementation
Radix-2 Radix-2 N, the sample size, must be a power of 2N, the sample size, must be a power of 2
Mixed-radixMixed-radix Can use different powers at different stagesCan use different powers at different stages Ex. 1000 = 2*2*2*5*5*5 (six stages) orEx. 1000 = 2*2*2*5*5*5 (six stages) or
1000 = 10 * 10 * 10 (three stages) 1000 = 10 * 10 * 10 (three stages)
FFT Implementation (cont.)FFT Implementation (cont.)
1.1. Pad input sequence, of N samples, with ZERO's until the Pad input sequence, of N samples, with ZERO's until the number of samples is the nearest power of two. number of samples is the nearest power of two.
e.g. 500 samples are padded to 512 (2^9) e.g. 500 samples are padded to 512 (2^9)
2.2. Bit reverse the input sequence. Bit reverse the input sequence. e.g. 3 = 011 goes to 110 = 6 e.g. 3 = 011 goes to 110 = 6
3.3. Compute (N / 2) Compute (N / 2) twotwo sample DFT's from the shuffled inputs. sample DFT's from the shuffled inputs. 4.4. Compute (N / 4) Compute (N / 4) fourfour sample DFT's from the two sample sample DFT's from the two sample
DFT's. DFT's. 5.5. Compute (N / 2) Compute (N / 2) eighteight sample DFT's from the four sample sample DFT's from the four sample
DFT's.DFT's. . . . . . .
6.6. Combine back into one N-sample DFTCombine back into one N-sample DFT
Fast Fourier Transform in the West Fast Fourier Transform in the West (FFTW)(FFTW)
Developed at MITDeveloped at MIT FreeFree collection of fast C routines for collection of fast C routines for
computing the DFT in 1 or more dimensionscomputing the DFT in 1 or more dimensions Includes complex, real, symmetric, and Includes complex, real, symmetric, and
parallel transforms parallel transforms MPI parallel transforms are only available in MPI parallel transforms are only available in
v. 2.1.5v. 2.1.5
FFTW cont.FFTW cont.
Serial/Parallel, Share/Distributed Memory
Faster than most “non-free” implementations
Portable, automatically adapt to machine
Two Phases of FFTWTwo Phases of FFTW
Hardware dependent algorithm Hardware dependent algorithm Planner Planner
‘‘Learn’ the fast way on your machine Learn’ the fast way on your machine Produce a data structure --‘plan’ Produce a data structure --‘plan’ Reusable Reusable
Executor Executor Compute the transform Compute the transform
Apply to all FFTw operation modes Apply to all FFTw operation modes 1D/nD, complex/real, serial/parallel1D/nD, complex/real, serial/parallel
MPI FFTW RoutinesMPI FFTW Routines fftwnd_mpi_plan fftwnd_create_plan(mpi_comm comm, fftwnd_mpi_plan fftwnd_create_plan(mpi_comm comm,
int rank, const *int n, fftw_direction dir, int flags); int rank, const *int n, fftw_direction dir, int flags);
void fftwnd_mpi_local_size(fftwnd_mpi_plan p, void fftwnd_mpi_local_size(fftwnd_mpi_plan p, int *local_first, int *local_first_start, int *local_first, int *local_first_start, int *local_second_after_transpose, int *local_second_after_transpose, int *local_second_start_after_transpose, int *local_second_start_after_transpose, int *total_local_size); int *total_local_size);
local_data = (fftw_complex*) malloc(sizeof(fftw_complex) local_data = (fftw_complex*) malloc(sizeof(fftw_complex) * total_local_size); * total_local_size);
work = (fftw_complex*) malloc(sizeof(fftw_complex) work = (fftw_complex*) malloc(sizeof(fftw_complex) * total_local_size); * total_local_size);
void fftwnd_mpi(fftwnd_mpi_plan p, int n_fields, void fftwnd_mpi(fftwnd_mpi_plan p, int n_fields, fftw_complex *local_data, fftw_complex *work, fftw_complex *local_data, fftw_complex *work, fftw_mpi_output_order output_order); fftw_mpi_output_order output_order);
void fftw_mpi_destroy_plan(fftwnd_mpi_plan p void fftw_mpi_destroy_plan(fftwnd_mpi_plan p
ExamplesExamples
View C source codeView C source code
fftw_mpi.c
fftw_mpi_test.c To compile:To compile:
cc -o ffmpi fftw_mpi_test.c –lmpi -lfftw_mpi -lfftw –lmcc -o ffmpi fftw_mpi_test.c –lmpi -lfftw_mpi -lfftw –lm
Matlab Example
ReferencesReferences
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