340 likes | 532 Views
Fourier transforms. http://aurora.phys.utk.edu/~forrest/papers/fourier/index.html http://www.yorvic.york.ac.uk/~cowtan/fourier/fourier.html DFTs: http://www.spd.eee.strath.ac.uk/~interact/fourier/fft.html, http://www.4p8.com/eric.brasseur/fouren.html, FFTs:
E N D
Fourier transforms http://aurora.phys.utk.edu/~forrest/papers/fourier/index.html http://www.yorvic.york.ac.uk/~cowtan/fourier/fourier.html DFTs: http://www.spd.eee.strath.ac.uk/~interact/fourier/fft.html, http://www.4p8.com/eric.brasseur/fouren.html, FFTs: http://www.dspguide.com/pdfbook.htm, Chapter 12 Wavelets: http://www.amara.com/IEEEwave/IEEEwavelet.html#contents
Basic Fourier transform • Multiply function by e-2pisxand integrate • But e-2pisx is cos(2psx) - i sin(2psx) • result is to multiply function by sin or cos and integrate Signal wave Signal wave Products of sine and signal Sine waves
Sample - square step signal • Note that sine wave has positive and negative values • Some components integrate to zero • Lower frequencies contribute more freq 1 2 3 4 5 Fourier component amplitudes products of sine & signal amplitude Positive part Negative part dc 2 4 frequency
Sample -- time-limited sine wave • Common in holography • All signals have some time limit Signal (8 cycles of sine wave) Freq of sine wave component 1 1.05 1.1 1.15 1.2 1.25 Product waveforms signal times sine Zero integral for deviation ~ 1/#cycles
Sine vs cosine • Which is better • depends on choice of origin • symmetric function -- cosine, anti-symmetric -- sine • Really want cos(2psx+ f) or sin(2psx+ f) • f contains origin info • Can be built up from sin and cos • A sin(2psx) + B cos(2psx) = (A2+B2)cos(2psx+tan-1(B/A)) Phase shift of sine component 0 0.2p 0.4p 0.5p = cosine 0.6p 0.8p p Signal (8 cycles of sine wave) Product waveforms -- signal times sine
Most important property of Fourier transforms • Fourier transform of product of 2 functions • convolution of Fourier transforms • F.T. of convolution is product (and converse) • great simplification -- critical for many applications Product Convolution Signal 1 Transform 1 Signal 2 Transform 2
Discrete Fourier transform • Fixed time sampling intervals • not continuous • Sampling interval must be fine enough • aliasing • Nyquist limit t = 1/(2f), where f is maximum Fourier frequency in signal Fine sampling Coarse sampling
Aliasing • Time sampling too far apart • Looks like sine wave of different freq Over-sampled -- faithful representation Under-sampled (solid lines)
More examples of aliasing • Theory developed for sound reproduction • digital music CDs
Fast Fourier Transform (FFT) • Normal DFT takes N2 operations • FFT takes NlogN operations • very important as N grows larger • many key DFT applications would not be practical without it
Form of FFT • Use complex representation • reduces second order diff eqns to first order eqns • Lowest freq component W = e2p i/N = cos(2p /N) + i sin(2p /N) • exactly one cycle over full waveform • Use powers of lowest freq • As in DFT, integral replaced by sum • Length of time step omitted • usually constant time frequency
Real DFT vs complex DFT cosine sine
Decomposition step • Decimation • Each step reduces size of problem by 2 • creates twice as many problems • each problem simpler • original problem N2 computation steps • reduced problem N single computation steps • log2N steps to reduce • result Nlog2N vs N2 even odd ee eo oe oo
even odd ee eo oe oo Decomposition step example • Each step reduces waveform complexity • Final result is single sample point • Fourier transform of single value = the value 0 15
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0000 0010 0100 0110 1000 1010 1100 1110 0001 0011 0101 0111 1001 1011 1101 1111 0000 0100 1000 1100 0010 0110 1010 1110 0110 0000 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 1111 0000 1000 0100 1100 Decomposition is simple swap • Look at binary representations of sample indices • Each step sorts by least significant bit • like perfect un-shuffle operation
Fourier transform step • FT of single-valued function is itself • Do nothing N = 1 time frequency W = e2p i/N
Recombination step • Reconstruct original function by reversing decomposition steps • Must work in Fourier domain Expand by padding with zeros Time shift odd part Sum
Summing step in recombination • FT of sum = sum of FTs time frequency W = e2p i/N Sum
Time-shift step in recombination • Multiply transform by “sine wave” -- • Product of FT and sine = convolution of function with time-shifted delta function Time shifter time frequency 2t’ = t Time shift odd part
Freq. from 0 to N expand frequency time Expand by padding with zeros • Non-intuitive • Expand by dividing frequency by 2 • does not change number of points • To add points need to add FT freq. Components (Nyquist f=1/2N) • What to add? • Frequencies from N to 2N-1 Add frequencies Expand by padding with zeros Choose so that f odd = 0
Example - expand and pad with zeros • Divide frequency by 2 • Add high frequency Fourier component • Same amplitude cos(2px/4) cos(2px/8) + cos(2px7/8) Pad with zeros
Example - expand, pad, time-shift • Correct result cos(2px/4) cos(2px/8) + cos(2px7/8) Pad with zeros Time shift sin(2px/8) [cos(2px/8) + cos(2px7/8)]
Operations needed - pad with zeros and time-shift • Duplicate low freq FT amplitudes in high freq components
Implementation of recombination • Use butterfly network • Multiply (time-shift), pad with zeros (duplicate), and sum Basic 2x2 is repeated to get NxN inter-connections
Quadratic speedup • FFT has N log2 N operations vs. N2 • quadratic for large N
2-D Fourier transforms FT of fuzzy dot • Magnitude and phase • both are important input FT • Graphical representation • phases color coded • white = 0 amplitude FT of array of fuzzy dots input FT
More 2-D FTs Inputs FTs • Convolution in 2-D • molecular crystal • FT of convolution = product of FTs “molecule” Array of molecules
Filtered FTs Recovered images Low pass filter Input 2D-FT High pass filter 2D FTs and filtering • Spatial filters • Take FT • Remove part of FT • Reconstruct input
Magnitude vs. phase • FT has real and imag parts • Convert to magnitude and phase • A sin(2psx) + B cos(2psx) = (A2+B2)cos(2psx+tan-1(B/A)) Inputs FTs Mixed FTs Output images duck Magnitude of duck phase of cat cat Magnitude of cat phase of duck
Lenses and FTs • Refraction -- Snell’s law • Lens is position-dependent wedge or prism • larger refraction angles away from center • Angle at lens becomes point at focal plane • delta function in angle (k-vector) becomes delta function in position x • like FT • what applies to delta functions also applies to complicated functions Ray tracings for lens
Wavelets • Input functions with discontinuities • large number of Fourier frequencies needed for edge • unnecessary computational overhead for rest of signal • Segment input -- use bandwidth limited sine waves • 1D analogy -- musical notes vs FT of entire symphony • can also generalize to more complex basis functions • Wavelets • variable grid • Truncated sine waves • fixed grid
Sample wavelets • Popular wavelets -- 4 main families • Daubechies has fractal character Top 4 wavelets Wavelet with fractal character
Wavelet applications • Fingerprint ID -- less storage than FT • 0.6 MB each, raw data -- FBI files 200 TB • Data smoothing • do wavelet transform • threshold and reconstruct • Speech synthesis • choose basis functions to minimize storage/computations Data smoothing Fingerprint storage/recognition Speech synthesis