O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

DSP_FFT_150525.pptx

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Carregando em…3
×

Confira estes a seguir

1 de 23 Anúncio

Mais Conteúdo rRelacionado

Semelhante a DSP_FFT_150525.pptx (20)

Mais recentes (20)

Anúncio

DSP_FFT_150525.pptx

  1. 1. Beirut Arab University Computer Engineering Program Spring 2015 Digital Signal Processing (COME 384) Instructor: Prof. Dr. Hamed Nassar Fast Fourier Transforms FFT  Textbook: ◦ V. Ingle and J. Proakis, Digital Signal Processing Using MATLAB 3rd Ed, Cengage Learning, 2012 1 Dr. Hamed Nassar, Beirut Arab Univ
  2. 2. DSP Windows  . Prof. H. Nassar, BAU
  3. 3. DSP Windows  . Prof. H. Nassar, BAU
  4. 4. DSP Windows MATLAB code  n=0:9 %stem ten samples  RectWin=ones(1,10)  sub1=subplot(4,1,1); stem(n, RectWin);grid  title('Rectangular Window');  TriWin=1-abs(length(n)-1-2*n)/(length(n)-1)  sub2=subplot(4,1,2); stem(n, TriWin);grid  title('Triangular Window');  HannWin=0.5-0.5*cos(2*pi*n/(length(n)-1)))  sub3=subplot(4,1,3); stem(n, HannWin);grid  title('Hanning Window');  HammWin=0.54-0.46*cos(2*pi*n/(length(n)-1))  sub4=subplot(4,1,4); stem(n, HammWin);grid  title('Hamming Window');  linkaxes([sub1,sub2,sub3,sub4], 'y')%Use same y scale for all subs Prof. H. Nassar, BAU
  5. 5. Constructing an infinite, periodic sequence from a finite one, and vv  . Prof. H. Nassar, BAU
  6. 6. Circular Shift Example: 4 left  . Prof. H. Nassar, BAU
  7. 7. Circular convolution  A linear convolution between two N-point sequences results in a longer sequence (length=N+N-1, with indices: 0, 1, …, 2N-2).  But we have to restrict our interval to 0 ≤ n ≤ N − 1, therefore instead of linear shift, we should consider the circular shift.  A convolution operation that contains a circular shift, as shown below, is called the circular convolution and is given by Prof. H. Nassar, BAU
  8. 8. Circular Convolution Example: Time domain approach (watch for circular folding)  . Prof. H. Nassar, BAU
  9. 9. Circular Convolution Example: Frequency domain approach  . Prof. H. Nassar, BAU
  10. 10. FFT  The DFT introduced earlier is the only transform that is discrete in both the time and the frequency domains, and is defined for finite-duration sequences.  Although it is a computable transform, its straightforward computation is very inefficient, especially when the sequence length N is large.  In 1965 Cooley and Tukey showed a procedure to substantially reduce the amount of computations involved in the DFT.  This led to the explosion of other efficient algorithms collectively known as fast Fourier transform (FFT) algorithms.  We will study one such algorithms in detail.  One concept used that the book does not speak about explicitly, but it is there (seen the previous example on circular convolution) is circular folding. Prof. H. Nassar, BAU
  11. 11. FFT  . Prof. H. Nassar, BAU
  12. 12. Example  . Prof. H. Nassar, BAU
  13. 13. )  . Prof. H. Nassar, BAU
  14. 14. Divide and Conquer Algorithm  . Prof. H. Nassar, BAU
  15. 15. Implementation  . Prof. H. Nassar, BAU
  16. 16. Implementation  . Prof. H. Nassar, BAU
  17. 17. EXAMPLE 5.21 N = 15, L = 3, M =5  . Prof. H. Nassar, BAU
  18. 18. EXAMPLE 5.21 N = 15, L = 3, M =5  . Prof. H. Nassar, BAU
  19. 19. EXAMPLE 5.21 N = 15, L = 3, M =5  . Prof. H. Nassar, BAU
  20. 20. Reminder: Classical DFT MATLAB script  % This is a DFT program without loops  clear all; %Write input sequence below  nx=0:5; x=[0 1 7 3 1 2] %index vector nx, then input signal x  N=length(x);  wN=exp(-2j*pi/N) %Base  E=[0:N-1]' *[0:N-1] %Prepare structure of matrix W  W=wN.^E %Matrix W=Base^Matrix (note the dot .)  Y=x*W %DFT = input sequence * Matrix  %To test, we'll obtain x(n=2)=1/N sum_k=0^N-1 Y e^(j*2*pi*n*k)  n=2  k=nx;  g=exp(2j*pi*n*k/N)  G=1/N*(Y*g.') Prof. H. Nassar, BAU
  21. 21. FFT Example: N = 6, M=4, L=2  x = {3, 1, 0, 2, 4, 1,3, 2} => x = {3, 1, 0, 2, 4, 1, 3, 2}  This has DFT: 10.0, 0.5-2.6i, 2.5+2.6i, 2.0, 2.5-2.6i, 0.5+2.6i  Always remember that: ◦ the 1D input vector x is first converted (reshaped) into a row-major matrix xm of size LxM ◦ the corresponding output DFT vector X is obtained as a column-major matrix X of size LxM, and thus has to be converted (reshaped) back into a 1D vector. ◦ The best summary of the Divide and Conquer FFT algo: Prof. H. Nassar, BAU
  22. 22.  clear all; % FFT using Divide & Conquer without loops  x =[3 1 0 2 4 1 3 2];L=2;M=4; %%Write input sequence and your choice for L and M  N=length(x)%N can be obtained auto, but M,L u should spec  x=reshape(x, [L,M]) %Create an LxM matrix (col maj) from x  wM=exp(-2j*pi/M) %Base M  EM=[0:M-1]' *[0:M-1]%Prepare structure of matrix W: MxM  WM=wM.^EM %Raise elements (note .) of Matrix to Base  WLMF=x*WM %Obtain F matrix  wN=exp(-2j*pi/N) %Base N  ELM=[0:L-1]'*[0:M-1] %Prepare structure of twiddle matrix:LxM  WLMT=wN.^ELM %Twiddle: Raise elements (.) of Matrix to Base  WLMG=WLMF.*WLMT %Modify elements (note .) of F by Twiddle  wL=exp(-2j*pi/L) %Base L  EL=[0:L-1]'*[0:L-1] %Prepare structure of matrix W:LxL  WL=wL.^EL %Raise elements (note .) of Matrix to Base  X=WL*WLMG %Final DFT  %To test, obtain x(n)=1/N sum_k=0^N-1 Y e^(j*2*pi*n*k) for some n  n=6; k=0:N-1; %MATLAB: u involve vec in an op, u get vec  XX=[X(1,:) X(2,:)] %Unfold matrix into a vector  g=exp(2j*pi*n*k/N) %Note in IDFT sign of e is +ve  G=1/N*(XX*g.') %IDFT for the given n. We could obtain whole x Prof. H. Nassar, BAU
  23. 23. 5  ) Prof. H. Nassar, BAU

×