This document contains lecture slides from a Digital Signal Processing course taught by Prof. Hamed Nassar at Beirut Arab University. The slides discuss topics related to fast Fourier transforms (FFTs) including window functions, circular convolution, and implementations of the discrete Fourier transform (DFT) and FFT using the divide and conquer algorithm. MATLAB code examples are provided to demonstrate concepts like windowing functions, circular shifts, and calculating the DFT and FFT.
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
DSP_FFT_150525.pptx
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
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
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
17. EXAMPLE 5.21 N = 15, L = 3, M =5
.
Prof. H. Nassar, BAU
18. EXAMPLE 5.21 N = 15, L = 3, M =5
.
Prof. H. Nassar, BAU
19. EXAMPLE 5.21 N = 15, L = 3, M =5
.
Prof. H. Nassar, BAU
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. 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. 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