Numerical Methods Discrete Fourier Transform Part: Discrete Fourier Transform http://numericalmethods.eng.usf.edu For more details on this topic Go to http://numericalmethods.eng.usf.edu Click on Keyword Click on Discrete Fourier Transform You are free to Share – to copy, distribute, display and perform the work to Remix – to make derivative works Under the following conditions Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial — You may not use this work for commercial purposes. Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. Lecture # 8 Chapter 11.04 : Discrete Fourier Transform (DFT) Major: All Engineering Majors Authors: Duc Nguyen http://numericalmethods.eng.usf.edu Numerical Methods for STEM undergraduates 4/13/2015 http://numericalmethods.eng.usf.edu 5 Discrete Fourier Transform Recalled the exponential form of Fourier series (see Eqs. 39, 41 in Ch. 11.02), one gets: ~ ikw0t f (t ) Ck e (39, repeated) k ~ 1 T Ck f (t ) e ikw0t dt T 0 6 (41, repeated) http://numericalmethods.eng.usf.edu Discrete Fourier Transform If time “ t ” is discretized at t1 t , t2 2t , t3 3t ,.......,tn nt , then Eq. (39) becomes: ~ ikw0tn f (t n ) Ck e N 1 k 0 7 (1) http://numericalmethods.eng.usf.edu Discrete Fourier Transform cont. To simplify the notation, define: tn n (2) Then, Eq. (1) can be written as: ~ ikw0n f ( n) Ck e N 1 (3) k 0 ilw0 n Multiplying both sides of Eq. (3) by e , and performing the summation on “n”, one obtains (note: l = integer number) 8 http://numericalmethods.eng.usf.edu Discrete Fourier Transform cont. N 1 f ( n) e n 0 ilw0 n ~ ikw0n ilw0n Ck e e N 1N 1 n 0 k 0 ~ Ck e N 1N 1 n 0 k 0 9 (4) i ( k l ) 2 n N (5) http://numericalmethods.eng.usf.edu Discrete Fourier Transform cont. Switching the order of summations on the right-hand-side of Eq.(5), one obtains: N 1 f ( n) e 2 il N n n 0 Define: N 1 2 N 1 i ( k l ) N k 0 n 0 ~ Ck e n 2 N 1 i ( k l ) n N (6) (7) A e n 0 There are 2 possibilities for ( k l ) to be considered in Eq. (7) 10 http://numericalmethods.eng.usf.edu Discrete Fourier Transform—Case 1 Case(1): ( k l ) is a multiple integer of N, such as: (k l ) mN ; or k l mN where m 0,1,2,...... Thus, Eq. (7) becomes: N 1 A e n 0 im 2n N 1 cos(mn2 ) i sin( mn2 ) n 0 (8) Hence: A N 11 (9) http://numericalmethods.eng.usf.edu Discrete Fourier Transform—Case 2 Case(2): ( k l ) is NOT a multiple integer of N . In this case, from Eq. (7) one has: A e n 0 N 1 2 i ( k l ) N n (10) Define: ae 12 i ( k l ) 2 N 2 2 cos(k l ) ) i sin (k l ) ) N N (11) http://numericalmethods.eng.usf.edu Discrete Fourier Transform—Case 2 a 1;because (k l ) is “NOT” a multiple integer of N Then, Eq. (10) can be expressed as: A a N 1 n 0 13 n (12) http://numericalmethods.eng.usf.edu Discrete Fourier Transform—Case 2 From mathematical handbooks, the right side of Eq. (12) represents the “geometric series”, and can be expressed as: A a N ; if N 1 n n 0 a 1 1 a ; if a 1 1 a (13) N 14 (14) http://numericalmethods.eng.usf.edu Discrete Fourier Transform—Case 2 Because of Eq. (11), hence Eq. (14) should be used to compute A . Thus: 1 a N 1 e i ( k l ) 2 A 1 a 1 a e 15 i ( k l ) 2 (See Eq. (10)) cos(k l )2 i sin(k l )2 1 (15) (16) http://numericalmethods.eng.usf.edu Discrete Fourier Transform—Case 2 Substituting Eq. (16) into Eq. (15), one gets A0 (17) Thus, combining the results of case 1 and case 2, we get A N 0 N 16 (18) http://numericalmethods.eng.usf.edu THE END http://numericalmethods.eng.usf.edu Acknowledgement This instructional power point brought to you by Numerical Methods for STEM undergraduate http://numericalmethods.eng.usf.edu Committed to bringing numerical methods to the undergraduate For instructional videos on other topics, go to http://numericalmethods.eng.usf.edu/videos/ This material is based upon work supported by the National Science Foundation under Grant # 0717624. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. The End - Really Numerical Methods Discrete Fourier Transform Part: Discrete Fourier Transform http://numericalmethods.eng.usf.edu For more details on this topic Go to http://numericalmethods.eng.usf.edu Click on Keyword Click on Discrete Fourier Transform You are free to Share – to copy, distribute, display and perform the work to Remix – to make derivative works Under the following conditions Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial — You may not use this work for commercial purposes. Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. Lecture # 9 Chapter 11.04: Discrete Fourier Transform (DFT) Substituting Eq.(18) into Eq.(7), and then referring to Eq.(6), one gets: N 1 f ( n)e n 0 ilw0 n ~ Ck N N 1 (18A) k 0 Recall k l mN (where l, m are integer numbers), And since k must be in the range 0 N 1, m 0. Thus: 25 k l mN becomes k l http://numericalmethods.eng.usf.edu Discrete Fourier Transform—Case 2 Eq. (18A) can, therefore, be simplified to N 1 ~ ilw0 n Cl N f ( n )e n 0 ~ ~ 1 N 1 ikw0 n Cl Ck f (n)e N n 0 1 N 1 f (n)cos(kw0 n) i sin( kw0 n) N n 0 where n t n and (18B) Thus: (19) f (n) Ck eikw0n Ck cos(kw0 n) i sin( kw0 n) 26 N 1 ~ N 1 ~ k 0 k 0 (1, repeated) http://numericalmethods.eng.usf.edu Discrete Fourier Transform cont. Equations (19) and (1) can be rewritten as ~ C n f ( k )e N 1 2 ik w0 N n k 0 1 ~ f (k ) Cn e N n 0 N 1 27 2 ik w0 n N (20) (21) http://numericalmethods.eng.usf.edu Discrete Fourier Transform cont. To avoid computation with “complex numbers”, Equation (20) can be expressed as ~ R ~ I N 1 R I Cn iCn f (k ) i f (k ) cos( ) i sin( ) k 0 (20A) where 2 k w0 n N 28 http://numericalmethods.eng.usf.edu Discrete Fourier Transform cont. ~ R ~ I N 1 R Cn iCn f (k ) cos( ) f I (k ) sin( ) k 0 i f I (k ) cos( ) f R (k ) sin( ) (20B) The above “complex number” equation is equivalent to the following 2 “real number” equations: ~ R N 1 R Cn f (k ) cos( ) f I (k ) sin( ) (20C) ~ I N 1 I Cn f (k ) cos( ) f R (k ) sin( ) (20D) k 0 k 0 29 http://numericalmethods.eng.usf.edu THE END http://numericalmethods.eng.usf.edu Acknowledgement This instructional power point brought to you by Numerical Methods for STEM undergraduate http://numericalmethods.eng.usf.edu Committed to bringing numerical methods to the undergraduate For instructional videos on other topics, go to http://numericalmethods.eng.usf.edu/videos/ This material is based upon work supported by the National Science Foundation under Grant # 0717624. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. The End - Really Numerical Methods Discrete Fourier Transform Part: Aliasing Phenomenon Nyquist Samples, Nyquist rate http://numericalmethods.eng.usf.edu For more details on this topic Go to http://numericalmethods.eng.usf.edu Click on Keyword Click on Discrete Fourier Transform You are free to Share – to copy, distribute, display and perform the work to Remix – to make derivative works Under the following conditions Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial — You may not use this work for commercial purposes. Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. Lecture # 10 Chapter 11.04: Aliasing Phenomenon, Nyquist samples, Nyquist rate (Contd.) When a function f (t ), which may represent the signals from some real-life phenomenon (shown in Figure 1), is sampled, it basically converts that function ~ into a sequence f (k ) at discrete locations of t. Figure 1: Function to be sampled and “Aliased” sample problem. 38 http://numericalmethods.eng.usf.edu Aliasing Phenomenon, Nyquist samples, Nyquist rate cont. ~ Thus, f (k ) represents the value of f (t ) at t t0 kt , where t0 is the location of the first sample (at k 0). In Figure 1, the samples have been taken with a fairly large t. Thus, these sequence of discrete data will not be able to recover the original signal function f (t ). 39 http://numericalmethods.eng.usf.edu Aliasing Phenomenon, Nyquist samples, Nyquist rate cont. For example, if all discrete values of f (t ) were connected by piecewise linear fashion, then a nearly horizontal straight line will occur between t1 through t11 and t12 through t16 respectively (See Figure 1). These piecewise linear interpolation (or other interpolation schemes) will NOT produce a curve which closely resembles the original function f (t ). This is the case where the data has been “ALIASED”. 40 http://numericalmethods.eng.usf.edu “Windowing” phenomenon Another potential difficulty in sampling the function is called “windowing” problem. As indicated in Figure 2, while t is small enough so that a piecewise linear interpolation for connecting these discrete values will adequately resemble the original function f (t ), however, only a portion of the function has been sampled (from t0 through t12) rather than the entire one. In other words, one has placed a “window” over the function. 41 http://numericalmethods.eng.usf.edu “Windowing” phenomenon cont. Figure 2. Function to be sampled and “windowing” sample problem. 42 http://numericalmethods.eng.usf.edu “Nyquist samples, Nyquist rate” Figure 3. Frequency of sampling rate (wS ) versus ( wmax ). maximum frequency content In order to satisfy F (w) 0 for w wmax the frequency (w) should be between points A and B of Figure 3. 43 http://numericalmethods.eng.usf.edu “Nyquist samples, Nyquist rate” Hence: wmax w ws wmax which implies: ws 2wmax Physically, the above equation states that one must have at least 2 samples per cycle of the highest frequency component present (Nyquist samples, Nyquist rate). 44 http://numericalmethods.eng.usf.edu “Nyquist samples, Nyquist rate” 45 Figure 4. Correctly reconstructed signal. http://numericalmethods.eng.usf.edu “Nyquist samples, Nyquist rate” In Figure 4, a sinusoidal signal is sampled at the rate of 6 samples per 1 cycle (or ws 6w0). Since this sampling rate does satisfy the sampling theorem requirement of ws 2wmax , the reconstructed signal does correctly represent the original signal. 46 http://numericalmethods.eng.usf.edu “Nyquist samples, Nyquist rate” In Figure 5 a sinusoidal signal is sampled at the rate of 6 samples per 4 cycles or ws 6 w0 Since this sampling rate does NOT satisfy the requirementws 2wmax , the reconstructed signal was wrongly represent the original signal! 4 Figure 5. Wrongly reconstructed signal. 47 http://numericalmethods.eng.usf.edu THE END http://numericalmethods.eng.usf.edu Acknowledgement This instructional power point brought to you by Numerical Methods for STEM undergraduate http://numericalmethods.eng.usf.edu Committed to bringing numerical methods to the undergraduate For instructional videos on other topics, go to http://numericalmethods.eng.usf.edu/videos/ This material is based upon work supported by the National Science Foundation under Grant # 0717624. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. The End - Really