1 / 181

Fourier Transformations: Algorithms, Polynomial Basis, and Evaluating in nlogn Time

Learn about the Fourier Transform and its applications in signal processing, data compression, and integer multiplication. Explore the FFT code, butterfly algorithm, polynomial multiplication, and more.

angelaf
Download Presentation

Fourier Transformations: Algorithms, Polynomial Basis, and Evaluating in nlogn Time

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Grad Algorithms Fourier Transformations • JPG • Polynomial Basis • Evaluating & Interpolating • FFT in nlogn Time • Roots of Unity • Same FFT Code & Butterfly • Inverse FFT • Polynomial Multiplication • Integer Multiplication • Sum of Sine/Cosine Functions • A Pulse, Linearity, & Periodic • Duality • Change of Basis • Orthogonal Basis • Rectangular vs Polar vs Complex • Continuous Functions • Radio Signal • Convolution • Linear Filter •   * • FFT in nlogn Time • FFT Code • FFT Butterfly Jeff Edmonds York University COSC 6111

  2. Fourier Transformation • Fourier Transform • are a change of basis from the time basis to • sine/cosine basis • JPG • or polynomial basis • Purposes: • Signal Processing • Compressing data (eg images with .jpg) • Multiplying integers in n logn loglogn time. • Error correcting codes. • …. Amazingly once you include complex numbers, the FFT code for sine/cosines and for polynomials are the SAME. The Scientist and Engineer's Guide toDigital Signal ProcessingBy Steven W. Smith, Ph.D. http://www.dspguide.com/ch8.htm

  3. Fourier Transformation Sine &CosineBasis y(t) A continuous periodic function t time Find the contribution of each frequency • Purposes: • Signal Processing • Compressing data (eg images with .jpg) • Multiplying integers in n logn loglogn time. • Error correcting cods. • …. Swings, capacitors, and inductors all resonate at a given frequency, which is how the circuit picks outthe contribution of a given frequency.

  4. Fourier Transformation Sine &CosineBasis y(x) = x Surely this can’t be expressed as sum of sines and cosines. y(x)  2 sin(x) - sin(2x) + 2/3 sin(3x)

  5. Fourier Transformation Sine &CosineBasis y(x) = x2 y(x)  -4 sin(x) + sin(2x) - 4/9 sin(3x)

  6. Fourier Transformation Sine &CosineBasis y(t) A continuous periodic function t time A discrete periodic function Time Domain y[j] j[0,n-1] y[] is an array of real values 10 9 7 6 5 4 3 2 1 8 j

  7. Fourier Transformation Sine &CosineBasis y(t) A continuous periodic function t time A discrete periodic function Time Domain y[j] j[0,n-1] The function y is expressedas a linear combination of the basis functions cf and sf. y[] YIm[] YRe[] Y[]

  8. Fourier Transformation Sine &CosineBasis y(t) A continuous periodic function t time A discrete periodic function Time Domain y[j] j[0,n-1] The function y is expressedas a linear combination of the basis functions cf and sf. YRe [f] is the coefficient of the bases function cf. YIm [f] is the coefficient of the bases function sf. Recall: ei = cos() + i sin() Hence, the coefficients of cosine are subscripted “Real” And of sine with “Imaginary”.

  9. Fourier Transformation Single Pulse Lets consider a few examples and a few properties. Time Domain y Frequency Domain Y Cosine with f=8 Impulse at Yre[8] Cosine wave Delta function One non-zero coefficient in the real frequency domain arises from what in the time domain? One cosine wave of the stated frequency.

  10. Fourier Transformation Single Pulse Time Domain y Frequency Domain Y Cosine with f=8 Impulse at Yre[8] Cosine wave Delta function In the discrete world, delta has one nonzero value, which is delta(8) = 1. In the continuous world, delta has the value 1/ for a width  for a total area of one.

  11. Fourier Transformation Single Pulse Time Domain y Frequency Domain Y Cosine with f=4 Impulse at Yre[4] Cosine wave Delta function A different frequency. A different coefficient?

  12. Fourier Transformation Linearity of FT Time Domain y Frequency Domain Y 2c 2c Cosine with f=4 Impulse at Yre[4] c c -c -2c -c Cosine wave Delta function Scale up the amplitude in the time domain. Scales up the amplitude in the frequency domain. Linearity of FT: If Y=FT(y), then cY=FT(cy)

  13. Fourier Transformation Linearity of FT Time Domain y Frequency Domain Y Linearity of FT: FT(c1∙y1+c2∙y2) = c1∙FT(y1) + c2∙FT(y2)

  14. Fourier Transformation Periodic Signals Time Domain y Frequency Domain Y y[j] j j Sine and cosine waves are periodic. The time domain is composed of these. Hence, the time domain is periodic. Strangely, the frequency domain is periodic too.

  15. Fourier Transformation Periodic Signals Time Domain y Frequency Domain Y One frequency solution Frequency This set of discrete points needs to be interpreted as a continuous function. This is the obvious solution. Leading to this frequency decomposition. This is another. Another. Cos(-) = Cos() = Cos(+2 ) =…

  16. Fourier Transformation Dualityof FT Time Domain y Frequency Domain Y Cosine with f=4 Impulse at Yre[4] Delta function Cosine wave Impulse at y[4] Ok, we know this. Delta function But what if we switch them?

  17. Fourier Transformation Dualityof FT Time Domain y Frequency Domain Y Cosine with f=4 Impulse at Yre[4] Delta function Cosine wave Cosine with f=4 Impulse at y[4] Delta function Cosine wave A single pulse in the time domainis produced from what sum of sines and cosines? Not clear! The curve of the coefficientsforms a sine/cosine wave! Strange but true!

  18. Fourier Transformation Dualityof FT Time Domain y Frequency Domain Y Cosine with f=4 Impulse at Yre[4] Delta function Cosine wave Cosine with f=4 Impulse at y[4] [ ][ ] =[ ] Delta function Cosine wave [ ][ ] =[ ] s1[1] s1[2] s1[1] s2[1] 1/n s2[2] s2[2] s1[2] s2[1] Arises from the duality of FT and its inverse. Sorry!we do this later. Y[1] Y[1] y[1] y[1] Y[2] y[2] Y[2] y[2]

  19. Fourier Transformation Dualityof FT Time Domain y Frequency Domain Y Cosine with f=4 Impulse at Yre[4] Delta function Cosine wave Cosine with f=4 Impulse at y[4] Delta function Cosine wave Arises from the duality of FT and its inverse. Duality of FT: If Y=FT(y), then y=FT(Y)

  20. Fourier Transformation Dualityof FT Time Domain y Frequency Domain Y How do you get these corner? Square wave Square wave Sinc function Sinc function ? Duality of FT: If Y=FT(y), then y=FT(Y)

  21. Fourier Transformation Dualityof FT Time Domain y Frequency Domain Y Gaussian Gaussian Duality of FT: If Y=FT(y), then y=FT(Y)

  22. Fourier Transformation Change of Basis • Change of Basis: T([a1,a2,…,ad]) = [A1,A2,…,Ad] • Changes the basis used to describe an object. • The Timebasis of a vector space: • A tuple <w1,w2,…,wd> of basis objects • Linearly independent • Spans the space uniquely"v $[a1,a2,…,ad],v = a1w1+a2w2 +… + adwd • The Fourier basis of a vector space: • A tuple <W1,W2,…,Wd> of basis objects • Linearly independent • Spans the space uniquely"v $[A1,A2,…,Ad], v = A1W1+A2W2 +… + AdWd

  23. Fourier Transformation Change of Basis • Change of Basis: T([a1,a2,…,ad]) = [A1,A2,…,Ad] • Changes the basis used to describe an object. "v $[a1,a2,…,ad],v = a1w1 +a2w2+… + adwd "v $[A1,A2,…,Ad],v = A1W1+A2W2 +… + AdWd NewBasis StandardBasis =[w1,w2]=[ , ] =[W1,W2]=[ , ] v = v = [ ][ ] =[ ] W2[2] W1[2] W2[1] W1[1] W1[1] W2[1] W2[2] W1[2] [A1,A2] = [a1,a2] = [11/5,32/5] [3,2] a1 A1 a2 A2

  24. Fourier Transformation Change of Basis • Change of Basis: T(y[0],y[1],…,y[n-1]) = [YRe[0],…,YIm[n/2]] • Changes the basis used to describe an object. "y $[y[0],y[1],…,y[n-1]],y = y[0]I1 +y[1]I2+… + y[n-1]In y[j] =[I1,I2,…] =[?,?] Time Basis j The time basis Ij[j’] =[ , ] one zero j ? = y = j’ y[1]=2 ? y[0]=3 ? A discrete periodic function

  25. Fourier Transformation Change of Basis • Change of Basis: T(y[0],y[1],…,y[n-1]) = [YRe[0],…,YIm[n/2]] • Changes the basis used to describe an object. "y $[y[0],y[1],…,y[n-1]],y = y[0]I1 +y[1]I2+… + y[n-1]In y[j] y = YRe[0]∙c1+YIm[0]∙s1+ ,…,YRe[n/2]∙sn/2+YIm[n/2]∙sn/2 c1 s1 =[I1,I2,…] =[c1,s1,..] =[?,?] Time Basis FourierBasis j =[ , ] =[ , ] y = y = y[1]=2 ? sn/2 cn/2 YIm[0] =32/5 y[0]=3 ? YRe[0] =11/5 A discrete periodic function

  26. Fourier Transformation Change of Basis • Change of Basis: T(y[0],y[1],…,y[n-1]) = [YRe[0],…,YIm[n/2]] • Changes the basis used to describe an object. "y $[y[0],y[1],…,y[n-1]],y = y[0]I1 +y[1]I2+… + y[n-1]In y = YRe[0]∙c1+YIm[0]∙s1+ ,…,YRe[n/2]∙sn/2+YIm[n/2]∙sn/2 c1 s1 =[I1,I2,…] =[c1,s1,..] Time Basis FourierBasis =[ , ] =[ , ] y = y = y[1]=2 s1[2] s1[1] s2[1] s1[1] sn/2 cn/2 YIm[0] =32/5 y[0]=3 s2[2] s1[2] s2[2] s2[1] YRe[0] =11/5 [ ] [ ] =[ ] [ ] [ ] =[ ] -1 y[1] Y[1] Y[1] y[1] y[2] y[2] Y[2] Y[2]

  27. Fourier Transformation OrthogonalBasis =[I1,I2,…] =[c1,s1,..] Evenly spaced points within an integer number of full cycles. This frequency basis vectors are orthogonal and of (almost) uniform length: Time Basis FourierBasis =[ , ] =[ , ] Sum of squares

  28. Fourier Transformation OrthogonalBasis =[I1,I2,…] =[c1,s1,..] This frequency basis vectors are orthogonal and of (almost) uniform length: Time Basis FourierBasis Evenly spaced points within an integer number of full cycles. =[ , ] =[ , ] Sum of products

  29. Fourier Transformation OrthogonalBasis =[I1,I2,…] =[c1,s1,..] This frequency basis vectors are orthogonal and of (almost) uniform length: Time Basis FourierBasis =[ , ] =[ , ] s1[2] [ ][ ]=[ ] s2[2] s1[1] s1[1] 0 n/2 s2[1] s1[2] s1[2] s2[1] n/2 0 s2[2] s2[2] -1 [ ]= [ ] s1[1] s1[1] s2[1] 2/n s2[1] s1[2] s2[2]

  30. Fourier Transformation OrthogonalBasis =[I1,I2,…] =[c1,s1,..] This frequency basis vectors are orthogonal and of (almost) uniform length: Time Basis FourierBasis =[ , ] =[ , ] [ ][ ] =[ ] [ ][ ] =[ ] s1[2] s1[1] s1[1] s2[1] 2/n s2[2] s2[1] s2[2] s1[2] This is the correlation between yand cf Y[1] y[1] y[1] Y[1] y[2] y[2] Y[2] Y[2]

  31. Fourier Transformation Change of Basis y∙c1 cos() = |y||c1| Viewing correlation a different way:   c1 y = y = y = y[1]=2 A1= |y|cos() = y∙c1 = j y[j]c1[j] YIm[0] =32/5 y[0]=3 YRe[0] =11/5 This is the correlation between yand cf

  32. Fourier Transformation Rectangular vs Polar vs Complex The contribution of a given frequency f can be expressed in different ways. • Rectangular Notation j j There are two basis(hence two coefficients) for each frequency f. n/2 frequencies are considered There are n values in the Time Domainand as needed n in the Frequency Domain. Note 2(n/2 +1)=n+2, because s1 = sn/2= 0

  33. Fourier Transformation Rectangular vs Polar vs Complex The contribution of a given frequency f can be expressed in different ways. • Rectangular Notation j j Any function y in the Time Domaincan be expressed as a linear combination of these n basis functions. Inverse Fourier Transform:

  34. Fourier Transformation Rectangular vs Polar vs Complex The contribution of a given frequency f can be expressed in different ways. • Rectangular Notation • Polar Notation The contribution from frequency f is: As needed, there are still n in the Frequency Domain.

  35. Fourier Transformation 1 θ Rectangular vs Polar vs Complex The contribution of a given frequency f can be expressed in different ways. • Complex Notation i -1 1 θ -i Proof: f(θ) = g(θ) f(0) = g(0) f’(0) = g’(0) g’’(θ) = -g(θ) eθi = cosθ + isinθ f’’(θ) = -f(θ)

  36. Fourier Transformation Rectangular vs Polar vs Complex The contribution of a given frequency f can be expressed in different ways. • Complex Notation • Rectangular Notation There is one basis(hence one coefficients) for each frequency f[0,n-1]. There are two basis(hence two coefficients) for each frequency f[0,n/2]. There are n values in the Time Domain. Hence n are needed in the Frequency Domain. eθi = cosθ + isinθ

  37. Fourier Transformation Rectangular vs Polar vs Complex The contribution of a given frequency f can be expressed in different ways. • Rectangular Notation • Complex Notation Any function y in the Time Domaincan be expressed as a linear combination of these n basis functions. Inverse Fourier Transform:

  38. Fourier Transformation Rectangular vs Polar vs Complex The contribution of a given frequency f can be expressed in different ways. • Rectangular Notation • Complex Notation Surprisingly the two techniques give the same numberswhen the time domain values are real.

  39. Fourier Transformation Continuous Functions y(t) A continuous periodic function t time y(t) is an function from real time to a real values. -½T 0 ½T The basis functions are the same. Except they also need to be continuous. Stretched so that a period of the basis lines up with a period of the signal. If this is the dominate musical note of frequency  = 2/T,then all the other basis functionsare its harmonics frequencies: Frequency: Note on the Piano:

  40. Fourier Transformation Continuous Functions y(t) A continuous periodic function t time y(t) is an function from real time to a real values. -½T 0 ½T The third basis, as before will cycle 3 times. Before the signal had n valuesso we needed n bases functions.Now we need n. Continue for ever.

  41. Fourier Transformation Continuous Functions y(t) A continuous periodic function t time y(t) is an function from real time to a real values. -½T 0 ½T Both the signal and the basis functionsrepeat every T units. Discrete: (previous defn) Continuous: (new defn) Called a Fourier Sequence.

  42. Fourier Transformation Continuous Functions y(t) A continuous periodic function t time y(t) is an function from real time to a real values. -½T 0 ½T Both the signal and the basis functionsrepeat every T units. Discrete: (previous defn) Continuous: (new defn) Called a Fourier Sequence.

  43. Fourier Transformation Continuous Functions y(t) A continuous non-periodic function t time We want T. -½T 0 ½T

  44. Fourier Transformation Continuous Functions y(t) A continuous non-periodic function t time We want T. -½T 0 ½T Continuous Periodic: (previous defn) Continuous Non-Periodic: (new defn) Continuous Non-Periodic Complex: (new defn)

  45. Fourier Transformation Continuous Functions These four definitions of Fourier Transformations look very different, but we will argue that they give pretty much the same answer. Discrete: Continuous Periodic: Continuous Non-Periodic: Continuous Non-Periodic Complex:

  46. Fourier Transformation Continuous Functions Time Domain y Frequency Domain Y YRe() y(t) 1 -T/2 -1 0 1 T/2 A single square  = (-,) Sinc function The threal Fourier coefficient is the correlation between 1and cos(t). Continuous Non-Periodic:

  47. Fourier Transformation Continuous Functions Time Domain y Frequency Domain Y YRe() y(t) 1 -T/2 -1 0 1 T/2 A single square f = 0, 1, 2,3, …, Sinc function This technique can’t be appliedbecause the signal is not periodic. Continuous Periodic:

  48. Fourier Transformation Continuous Functions Time Domain y Frequency Domain Y YRe() y(t) YRe[f] 1 -T/2 -1 0 1 T/2 A square wave f = 0, 1, 2,3, …, Sinc function  is a real number f is an integer Continuous Periodic:

  49. Fourier Transformation Continuous Functions Time Domain y Frequency Domain Y YRe() y(t) YRe[f] 1 -T/2 -1 0 1 T/2 Discrete: A square wave f = 0, 1, 2,3, …,n Sinc function  is a real number f is an integer

  50. Fourier Transformation Continuous Functions Time Domain y Frequency Domain Y YRe() y(t) 1 -T/2 -1 0 1 T/2 A square wave  = (-,) Sinc function The Y[f] discrete signal at f is replaced at =2f/T with a continuous delta with value Y[f]/dt =  of width dt for a total area of Y[f]. else zero.  is a real number f is an integer Continuous Non-Periodic:

More Related