Example1: Consider a length-N sequence defined for n = 0,1,2,……,(N-1) where n0 1 x[n] 0 otherwise Find the DFT of the given sequence . N 1 The N-point DFT is equal to X [k ] x[n]WN kn k 0,1,2,......., ( N 1) n 0 1 Example2: Consider a length-N sequence defined for n = 0,1,2,……,(N-1) where nm 1 y[n] 0 otherwise Find the DFT of the given sequence . N 1 The N-point DFT is equal to Y [k ] x[n]WN kn k 0,1,2,......., ( N 1) n 0 WNkm Example 3: Consider an L up-sampler described by the discrete sequence xn L y[n] 0 n 0, L,2 L,...... otherwise Find the DTFT of this sequence. The input/output relationship in frequency domain is: Y e jw xn Le jwn n mult of L Substituting, m = (n/L) Y e jw xme jwLm X e jwL m Example: X(ejw) x[n] n /2 w 2 2 2 Commonly used General Properties of the DFT Assume that we denote the data sequence x(nT) as x[n] . (1) Symmetry property Re[X(N-k)]=ReX(k) This implies that amplitude has symmetry . Im[X(N-k)]= - Im[X(k)] This implies that the phase spectrum is antisymmetric. (2) If x[n] is an even function xe[n] then N 1 F xe n X e k xe ncosknT n 0 This implies that the transform is also even (3) If x[n] is odd function xo[n] than N 1 F xo n X o k j xo nsin knT n 0 This implies that the transform is purely imaginary and odd (4) Parseval’s Theorem The normalized energy in the signal is given by either of the following expressions N 1 x 2 n n 0 1 N 1 2 X k N k 0 (5) Delta Function F nT 1 (6) Unit step function F u[n] 1 w 2k 1 e jw k (7) 2 w w F e jw0n 0 k 2k Fourier transform of a CT complex exponential is interpreted as an impulse at w=w0. For discrete-time we expect something similar but difference is that DTFT is periodic in w with period 2. This says that FT of x[n] should have impulses at w0, w0 ±2, w0±4 etc. (8) n u[n] F ( n 1) 1 1 e jw (9) Linear cross-correlation of two data sequences or series may be computed using DFTs. The linear cross correlation of two finite-length sequences x1[n] and x2[n] each of length N is defined to be: rx1x2 ( j ) 1 N x nx n j n 1 2 , j Circular correlation of finite length periodic sequences x1p[n] and x2p[n] is described as: rcx1x2 ( j ) 1 N 1 x1 p nx2 p n j N n 0 , j 0,......., ( N 1) This circular correlation can be evaluated using DFTs as shown below: rcx1x2 ( j ) F 1 X 1 k X 2 (k ) The circular correlation can be converted into a linear correlation by using augmenting zeros. If the sequences are x1[n] of length N1 and x2[n] of length N2, then their linear correlation will be of length N1+N2-1. To achieve this x1[n] is replaced by x1a[n] which consists of x1[n] with (N2-1) zeros added and x2[n] is augmented by (N1-1) zeros to become x2a[n]. rx1x2 ( j ) F 1 X 1a k X 2a k Symmetry Relations of the T of a real sequence Sequence x[n] FourierTransform X e X re e jw jX im e jw xev [n] X re e jw xod [n] jX im jw e jw conjugate symmetry X e X e real part is even X e X e imaginary part is odd X e X e even magnitude odd phase argX e argX e X e jw X e jw jw jw re re jw jw im im jw jw jw jw General Properties of the DT Fourier Transform Property Linearity Time Shifting Conjugation Time Reversal Frequency Shifting First Difference Conjugate Symmetry for Real Signals Real & Even Signals Real & Odd signals Even-Odd Decomposition Of Real Signals Parseval’s Relation Periodic signal Fourier Series Coefficients Aak Bb k Ax[n] By[n] x[ n n0 ] ak e x [n] x[n] 2 jk n0 N a k ak ak M e jMw n x[n] x[n] x[n 1] 0 1 e jk 2 N a k x[n] real a k a k x[n] real and even a k real and even x[n] real and odd a k purely imaginary and odd xe [n] Evx[n] xo [n] Odx[n] Reak j Imak [ x[n]real ] [ x[n]real ] 1 N x[n] n N 2 ak k N 2 Example: Given the discrete sequence below find and plot the DTFT of the signal. x[n] cos w0 n Using X e jw 2 w w l X e jw w l with w0 0 2 5 2l 2 2 2l w 2l 5 5 l that is; 2 X e jw w 5 2 w 5 w and X e jw repeats with period of 2 as shown below: X e jw w -2 -wo 0 wo 2- wo 2 2+ wo Time Shifting: Example. Find the DTFT of an impulse function which occurs at time zero. x[n] [n] X e jw [n]e jwn 1 F [n] 1 F [n 1] (1) e jw(1) Convolution Property: If x[n] , h[n] and y[n] denote the input , impulse response and output of an LTI system then y[n] x[n] h[n] Y e jw X e jw H e jw where, Y e jw , X e jw and H e jw are the DTFT of the DT sequences. Example: Consider an LTI system with impulse response and input as given below h[n] n u[n] 1 x[n] n u[n] 1 Develop an expression for the response of the system? X e jw 1 1 e jw 1 1 e jw H e jw 1 e 11 e Y e jw X e jw H e jw jw jw 1 Ae 1 Be Y e jw jw (2) jw Using (1) and (2) and solving for A and B gives A B 1 e 1 e Y e jw jw jw Hence y[n] 1 n1u[n] n1u[n] Case2: If Ye jw 1 1 e jw 2 1 jw 1 e 2 the above expression is also equal to : Y e jw 1 1 e jw 2 j e jw (1) d 1 jw dw 1 e for Proof: We know that the differentiation in frequency dictates the following dX e jw j dw n x[n] since n u[n] 1 1 e jw F we can together with above property say the following is also correct n n u[n] F j d 1 dw 1 e jw to account for the factor e jw we need to use a time-shift in the time-domain signal n 1 n1u[n 1] Finally to account for the factor F 1 je jw d 1 jw dw 1 e 1 we can write y[n] n 1 n u[n 1] We note that n 1 nu[n 1] is still zero prior to n = 0 since (n+1) = 0 at n = -1 Hence the final result can be written as: y[n] n 1 n u[n] Example: Consider the sequence x[n] whose Fourier Transform X(ejw) is depicted for - <= w <= . Determine if x[n] is periodic, real, even, and/or finite energy. | X(ejw) | X(ejw) 2 3 - 2 -2 - -/2 0 /2 w If a signal is periodic and yet discrete the discrete-time Fourier Transform of it can not be continuous. It shall be zero except possibly for impulses located at various integer multiples of the fundamental frequency. x[n] is not periodic From the symmetry properties for Fourier transforms a real valued sequence must have a Fourier transform of EVEN magnitude and a phase function that is ODD. x[n] is real by observation of the plots given above If x[n] is an even function then by symmetry properties for real signals X(ejw) must be real and even. Since X e jw X e jw e j 2 w The DTFT can not be a real valued function due to the complex ecponential x[n] is not even Finally to test the finite-energy property we can use Parseval’s relation. xn 2 n 1 2 X e jw 2 dw 2 it is clear from the above figure that carrying out this integral will lead to a finite quantity. We conclude that x[n] has finite energy. DTFT Computation Using MATLAB The related matlab functions that can be used are : freqz abs angle unwrap real imag Function “freqz” can be used to compute the values of the DTFT of a sequence described as a rational function in terms of ejw: X e jw p0 p1e jw ........ p M e jwM P e jw D e jw d 0 d1e jw ........ d N e jwN at a predefined set of discrete frequency points w = wl . For an accurate plot a fairly large number of frequency points should be selected. There are various forms of the function: H = freqz( num, den, w) H = freqz( num, den, f, FT) [H,w] = freqz( num,den,k) [H, f] = freqz(num,den, k, FT) [H,w] = freqz( num,den,k,’whole’) [H, f] = freqz(num,den, k, ‘whole’FT) freqz refers to the frequency response values as a vector H of a DTFT defined in terms of the vectors num and den containing the coefficients {pi} and {di} respectively at a predefined set of frequency values. ‘w’ is a vector which contains the prescribed set of frequencies between 0 and 2. In H = freqz(num,den,f,FT) FT is the sampling frequency Vector f provides the pre-defined values in range 0 FT/2 Also it is possible to specify the total number of frequency points by ‘k’ in the argument of freqz. In this case DTFT values H are computed at k equally spaced points between 0 and and returned as the output vector w. For faster computations it is recommended that the number ‘k’ be chosen as a power of 2 such as 256 or 512. Once the DTFT values have been determined they can be plotted either showing their real or imag parts or by magnitude and phase components using functions “abs” and “angle”. Function angle computes the phase in radians. freqz(num,den) with no output arguments computes and plots the magnitude and phase response values as a function of frequency in the current figure window. Reminder: Here show the slides about a MATLAB program using some of the above Computational Complexity of the DFT A large number of multiplications and additions are required for the calculation of the DFT. Let us try to analyze the following case. For an 8-point DFT the expansion for X(k) becomes the following: 7 X (k ) xn e jk 2n / 8 , k 0,1,........,7 (1) n 0 If we rename the quantity ( k2/8 ) as K we can write the expanded summation as : X (k ) x0e K 0 x1e jK1 x2e jK 2 x3e jK 3 x4e jK 4 x5e jK 5 x6e jK 6 x7 e jK 7 , k 0,1,...............,7 (2) Equation (2) contains eight terms on the right hand side . Each term consists of a multiplication of an exponential term (complex) by an other term which is real or complex. Then each of the product terms is added together. Therefore there are eight complex multiplications and seven complex additions to be calculated. For a N-point DFT there will be N-complex multiplications (N-1) complex additions for the 8-point DFT there are also 8 harmonic components to be evaluated (k=0,1,……,7) . For the N-point DFT this number becomes N. Therefore the total calculations of the 8-point DFT requires : 8×8 = 64 complex multiplications 8×7 = 56 complex additions. For the N-point DFT this becomes : N×N=N2 complex multiplications N(N-1) complex additions These numbers may seem small but then N= 1024 then approximately one million complex multiplications and one million complex additions are required. Clearly we need some means of reducing these numbers. These numbers can be reduced if we note the redundancy that exists in the DFT expression. i.e. k 1, and n 2, e jk 2n / 8 e j / 2 k 2, and n 1, e jk 2n / 8 e j / 2 The Decimation-in-time fast Fourier Transform algorithm In this section we show how the redundancy in DFT is used o reduce the number of calculations. For the 1024-point DFT the number of calculations required can be reduced by a factor of 204.8. The algorithm which can achieve this is given the name fast Fourier Transform (FFT). When applied in the time-domain the algorithm is referred to as the decimation-in-time (DIT) FFT. Decimation here refers to the significant reduction in the number of calculations performed on time-domain data. The first DIT algorithm was introduced by Cooley and Tukey (1965). NOTE: Computational savings will be seen to increase as N 2 ( N / 2) log 2 N . We will first try to establish some mathematical relationships. Let us start with the DFT definition: N 1 X 1 k xn e j 2nk / N , k 0,......., ( N 1) n 0 j 2 / N Also the factor e will be written as WN. Hence N 1 X 1 k x nW Nnk , k 0,......., ( N 1) n 0 We note at this point some of the properties of WN. Firstly; WN2 e j 2 / N 2 e j 2 2 / N e j 2 /( N / 2 ) W N / 2 Secondly; W N( k N / 2) W Nk WNN / 2 WNk e j 2 / N ( N / 2 ) WNk e j WNk For exploiting the computational redundancy the data-sequence is divided into two equal sequences: one of even-numbered data, and one of odd-numbered data. For the sequences to be of equal length they must all contain an even-number of data. If not an augmenting zero can be added. This allows the DFT to be converted into two DFTs each o N/2 points. This process then repeated until X1(k) is decomposed into N/2 DFTs each of two points both of which are initial data. In practice the initial data is re-ordered and the N/2 two-point DFTs are calculated by taking the data in pairs. These DFT outputs are combined to provide N/4 four-point DFTs. Then these N/4 four-point DFTs are combined to form the N/8 eight-point DFTs Etc . Reminder: Draw the table 3.1 on board as example Table 1. Data Sequence A0 8-point DFT of A0 Re-ordered A0 into two Sequences A1 and A2 4-point DFTs of A1 and A2 Reordered Sequences A1 and A2 Structure of 8-point FFT k- ranges N ranges 0,…….,7 0,……,7 0,…….,7 x0 , x1 , x2 , x3 , x4 , x5 , x6 , x7 X 1 k X 11 k W Nk X 12 k A1 A2 x0 , x 2 , x 4 , x6 X 11 k X 21 k W Nk / 2 X 22 k A3 x0 , x 4 A4 x 2 , x6 X 12 k X 23 k WNk / 2 X 24 k A5 x1 , x5 0,….....,7 x1 , x3 , x5 , x7 A6 0,…….,3 0,…….,3 x3 , x 7 0, 1 four sequences A3, A4, A5, A6 2-point DFTs of A3, A4, A5 and A6 X 21 k x0 W Nk / 4 x 4 X 22 k x 2 WNk / 4 x6 X 23 k x1 WNk / 4 x5 X 24 k x3 W Nk / 4 x7 0,1 The suffixes , n, extend from n = 0 to n =N-1 corresponding to the data values. The terms in the even sequence may be designated x2n with n = 0 to n = N/2 -1. The terms in the odd sequence becomes x2n+1 . Even sequence Odd sequence ( N / 2 ) 1 ( N / 2 ) 1 n 0 n 0 X 1 k x 2 nW N2 nk x 2 n 1W N2 n 1k ( N / 2 ) 1 x2nWN2nk WNk ( N / 2 ) 1 n 0 Using the fact that x n 0 , k 0,......., ( N 1) W N2 nk 2 n 1 WN2 e j 2 / N 2 e j 2 2 / N e j 2 /( N / 2 ) W N / 2 one can write WN2 nk W Nnk/ 2 . Hence X 1 k ( N / 2 ) 1 x2nWNnk/ 2 WNk n 0 ( N / 2 ) 1 x n 0 WNnk/ 2 2 n 1 , k 0,......., ( N 1) Equation above can be written as X 1 k X 11 k W Nk X 12 k Here; , k 0,........, N 1 X11k is the DFT of the even sequence X 12 k is the DFT of the odd sequence The factor W Nnk/ 2 occurs in both sums but needs calculating only once. (3)