Dft and its applications

13,704 views

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
13,704
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
369
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Dft and its applications

  1. 1. SIGNALS AND SYSTEMS-EEL 205 DFT AND ITS APPLICATIONSA study submitted at IIT,Delhi as a part of EEL 205 course requirement RISHABH DUDEJA (2011EE10477) AGAM GOEL (2011EE20505)
  2. 2. ACKNOWLDGEMENT We have taken great efforts in this project.However, it would not have been possible without thekind support and help of many individuals. I would liketo extend my sincere thanks to all of them.We are highly indebted to Professor S.D Joshi for hisguidance and constant supervision. He provided us withnecessary information regarding the project &invaluable support in completion of the project.We would like to express our gratitude towards ourparents for their kind co-operation and encouragementwhich helped us in the completion of this project.My thanks and appreciations also go to my friends indeveloping the project and people who have willinglyhelped me out with their abilities. Rishabh Dudeja Agam Goel
  3. 3. ABSTRACTThe study looks at an alternative representation of signals known as theDiscrete Fourier Transform (DFT). DFT has widespread applications in SpectralAnalysis of systems, LTI systems, Calculating convolution of signals,multiplication of large polynomials, noise removal etc.Computing DFT of a signal via normal computations takes a considerable time.We have calculated DFT using the famous algorithm of Fast Fourier Transform(FFT). There are several other variations to calculate DFT also.Thereafter, we have looked at logics to compute Inverse DFT to get back asignal from its DFT. This has been done using two well-known tricks whichinvolve conjugation and reversing of the DFT. We have implemented Linearand Circular convolution using the normal methods and the DFT method.We have plotted graphs for each algorithm to show their time complexity, byusing signals of various sample lengths. Also, to further validate our algorithms, we have computed DFT’s and Inverse DFT using Matlab inbuilt function andshown the results to be the same.We have also shown the relationship between DFT and DTFT and that insteadof storing the whole continuous DTFT, we can simply store finite points of DTFTand still recover the signal.Along with the Project report, we have attached soft copies of the variousprograms we have developed in Matlab along with their GUI implementation.GUI implementation allows one to compute DFT’s Inverse DFT’s andconvolution for various types of signals from square to exponential and evencustom signals. Custom signals have to be input in the form of a list.
  4. 4. DISCRETE FOURIER TRANSFORMThe discrete Fourier transform (DFT) is a specific kind of discrete transform, used in Fourier analysis.It transforms one function into another, which is called the frequency domain representation, or simplythe DFT, of the original function (which is often a function in the time domain. The DFT requires aninput function that is discrete. Such inputs are often created by sampling a continuous function, suchas a persons voice. The discrete input function must also have a limited (finite) duration, such as oneperiod of a periodic sequence or a windowed segment of a longer sequence.Unlike the discrete-time Fourier transform (DTFT), the DFT only evaluates enough frequencycomponents to reconstruct the finite segment that was analyzed. The inverse DFT cannot reproducethe entire time domain, unless the input happens to be periodic. Therefore it is often said that the DFTis a transform for Fourier analysis of finite-domain discrete-time functions.In particular, the DFT is widely employed in signal processing and related fields to analyze thefrequencies contained in a sampled signal, to solve partial differential equations, and to perform otheroperations such as convolutions or multiplying large integers. A key enabling factor for theseapplications is the fact that the DFT can be computed efficiently in practice using a fast Fouriertransform (FFT) algorithm.FFT algorithms are so commonly employed to compute DFTs that the term "FFT" is often used tomean "DFT" in colloquial settings. Formally, there is a clear distinction: "DFT" refers to a mathematicaltransformation or function, regardless of how it is computed, whereas "FFT" refers to a specific familyof algorithms for computing DFTs.The sequence of N complex numbers x0.... xN−1 is transformed into another sequence of N complexnumbers according to the DFT formula:
  5. 5. FAST FOURIER TRANSFORMOne of the reasons for the significant increase in the use of computerised techniques was thedevelopment of a very efficient technique known as the FAST FOURIER TRANSFORM (FFT) algorithmfor the calculation of the DFT of finite duration sequences.One method of calculation of the DFT is by direct evaluation. A useful measure of the complexity ofsuch a computation is the total number of complex computations required. Clearly for calculationeach point of the DFT we require N computations and hence for a complete N point DFT we have N2It is convenient to write the above equations as:Where ,Suppose that N is even and a power of 2. Let f[n]=X[2n] represent the even indexed samples andg[n]=X[2n+1] represent the odd indexed samples.. Clearly f[n] and g[n] are zero outside the interval0≤n≤(N/2)-1.The N-point DFT of X[n] can be expressed asWhereAlso, clearly a N point DFT is periodic with period N. This main point is basically going to help usdecrease our computations. The N-point DFT of X[n] can be calculated in terms of two DFT’s oflength N/2. Even if we now compute the DFTs of the 2 halves using the traditional algorithm,number of computations required is N2/2, less than N2. Actually these halves are furtherdecomposed and hence the computational advantage is enormous.
  6. 6. If N is a power of two, then we can decompose function at every step into sequences of even andodd indexed samples, and therefore their DFT’s can be computed using the same process. We caniterate the process, thus achieving significant savings in computation time. The time complexity ofthe program will be Nlog(N) which is a significant improvement over N2To implement FFT using the matlab , firstly we have created a function ‘expmatrix’ which returns anarray of complex exponentials of desired period.The following is the ‘myfft’ function which calculates the nearest power of 2 point DFT of the inputsignal using the FFT algorithm as was described above. Note that even if we input a signal which isnot of length which is a power of 2, it converts it into one by zero-padding. That is the remainingpoints are assigned the value of 0.Here , we have taken samples of the sine signal, and then found out its DFT using the built in FFT andour version of FFT. Finally, the signal has also been recovered using IFFT.
  7. 7. INVERSE FAST FOURIER TRANSFORMOne major advantage of the DFT is that that its inverse can be computed using the DFT functionitself.Expressing the inverse DFT in terms of DFT (i.e. finding out the signal if its DFT has been given) canbe done using several well known tricks: 1) First, we can compute the inverse DFT by reversing the inputs:The subscripts are interpreted modulo N.Following is the program ‘myIFFTver2’ to calculate the inverse DFT using the above algorithm. Notefliplr reverses the signal. 2) Second, one can also conjugate the inputs and outputs:Following is the program ‘myIFFT’ to calculate the inverse DFT using the above logic.
  8. 8. CIRCULAR CONVOLUTION USING DFTCircular ConvolutionThe circular convolution, also known as cyclic convolution, of two aperiodic functions occurs whenone of them is convolved in the normal way with a periodic summation of the other function. Thatsituation arises in the context of the Circular convolution theorem. The identical operation can alsobe expressed in terms of the periodic summations of both functions, if the infinite integrationinterval is reduced to just one period. That situation arises in the context of the discrete-timeFourier transform (DTFT) and is also called periodic convolution. In particular, the transform (DTFT)of the product of two discrete sequences is the periodic convolution of the transforms of theindividual sequences.Circular convolution using DFT can be calculated in many ways.Algorithm 1In this, Let X1[n] and X2[n] be the two signals whose circular convolution we have to compute. Wecalculate the N point DFT of both the signals. It is important to calculate the same point DFT of boththe signals. The number of points in the DFT is the period of the circular convolution obtained. Nowmultiply the DFT’s point wise. After this calculate IDFT of the resultant to get the required solution.Consider the number of computations if we do the DFTs using FFTs: Each transform requires O(NLog(N))operations, the multiplication is O(N) , and the inverse transform is O(NLog(N)) . Theoverall computation is O (NLog(N)), which saves a significant amount of time , specially for large N.Here is the matlab implementation of the above algorithm using the self designed DFT myfft.
  9. 9. The code given below uses the inbuilt fft function.
  10. 10. Algorithm 2Circular convolution computed directly from its summation formula.The above algorithm has been implemented in the function mycconv.The function basically computes the value of circular convolution of the 2 functions from 0 to N-1 byactually evaluating the summation in an internal while loop. The first signal is treated as a finite holdsignal and hence the upper and lower limits of the summation are N-1 and 0 rather than infinity andnegative infinity. The second signal is assumed to be periodic with period N. Hence its arguments aretaken modulo N. The order of the function coded above is O (N2). The computation of the convolvedfunction at any point required computation of N products – x(0)y(n-0), x(1)y(n-1)…..x(n-1)y(1) andtheir summation i.e. O(N) operations. Since value of the convolved function needs to be computedat N pts, the overall order is O (N*N) =O (N2).
  11. 11. Here, we have done circular convolution of sine and cosine.Period of convolution=150Time for FFT based convolution=extremely small O( NlogN)Time for inefficient convolution (the one done in terms of linear convolution) =0.001594sec O(N2)Clearly, one can observe the huge time difference.
  12. 12. LINEAR CONVOLUTION USING DFTAlgorithm 1The linear convolution equals the circular convolution provided the period of the circularconvolution is large enough.To see this interpret the circular convolution as:The periodic extension of x2 is obtained by passing the discrete delta function through an LTI whoseimpulse response is x2. Since the circular convolution is nothing but the linear convolution of x1 withperiodic extension of x2. It can be obtained as the response of an LTI with impulse response x1 toperiodic x2. The response thus obtained is multiplied by a rectangular window of size N to extract asingle period and hence find circular convolution. Since convolution is a commutative operation theorder of these LTIs can be changed as:
  13. 13. Now, circular convolution can be simply interpreted as a periodic extension of linear convolution.Now when 2 signals of M and L are convolved the linear convolution always has length M+L-1. If theperiod for extension of this linear convolution is more than or equal to M+L-1, then the variousperiods don’t interfere with each other and the linear convolution can be obtained as a one periodextraction of circular convolution. If it is less than L+M-1 aliasing occurs between various periods andthe linear convolution is lost.Hence to obtain linear convolution we find the circular convolution of the 2 signals with a periodN>=L+M-1 say in particular L+M using the FFT based algorithm for circular convolution. We thenextract the first L+M-1 samples from the circular convolution and obtain the linear convolution inthe order of the DFT algorithm that is NlogN.We have implemented it using both myfft functions:
  14. 14. And built in FFT function:Algorithm 2Linear convolution computed directly from its summation formula.If we have 2 signals f and g of finite holds say L and M, all indices in the summation aren’t valid infact the summation start index can be replaced by:Start=max (0, n-M+1)End=min (L-1, n)Where n denotes the value at which f*g is being evaluated.The program given below basically evaluates the summation explicitly using while loops. Like thecircular convolution it takes O (N2) time.
  15. 15. Here, we have done linear convolution between the exponential signal and the square signal.Time for FFT based convolution=0.0001153secTime for inefficient convolution=0.0003166sec
  16. 16. RELATIONSHIP BETWEEN DFT AND DTFTA finite duration discrete signal which is non zero only between 0 to N-1 can be represented infrequency domain using two transforms:The Discrete time Fourier transform which defines a corresponding function X (Ω):Since the signal is non zero beyond 0 and N-1,AndUsing the N-point DFT (N>signal length):The 2 equations simply show:What these means is that is nothing but the discretized version of , the number ofequispaced samples being equal to N. Note that the samples are only taken betweenHowever, since is periodic with , these are sufficient.Since, it is possible to reconstruct the the signal using both its DFT and its DTFT it simply shows thatthe information contained in a continuous time signal can be stored by simply taking Nsamples provided N is greater than the signal length.This also suggests a method to approximate the DTFT plot in matlab by simply interpolating the Nsamples of the N point DFT. The greater are the number of samples i.e. greater the value of N, themore closely spaced samples are, and more continuous looking the DTFT plot is.
  17. 17. The following figure shows the implementation:The first plot is the signal, the second the closest power of 2 DFT and the last the DTFT plot by takingat 1024 pt DFT.
  18. 18. REFERENCESLITERARY RESOURCES  Signals and Systems, 2nd edition, Alan V. Oppenheim  The scientist and Engineer’s guide to digital signal processing, Steven SmithONLINE RESOURCES  http://ocw.mit.edu/index.htm : Lectures By Alan Oppenheim on convolution  www.mathsworks.in  www.wikipedia.com  www.google.com  http://ee.sjtu.edu.cn  http://ee.sjtu.edu.cn/st/studio/my/9304/Fundamentals%20of%20Signal%20Processing/A.% 20Basics%20of%20Discrete%20Fourier%20Transform.pdf  http://www.physics.iitm.ac.in/~kavita/sujoyketan.pdf  http://www.ele.uri.edu/~hansenj/projects/ele436/fft.pdf

×