315class40 Handout

2
EE 315 Class 40 Discrete Fourier Transform and Fast Fourier Transform (FFT) Let x[n] be a discrete-time signal with DTFT X (Ω). Since X (Ω) is a function of the continuous variable Ω, it cannot be stored in the memory of a computer unless X (Ω) can be expressed in closed-form. Practical signals do not result in closed-forms. Suppose x[n] is time-limited, i.e. x[n] = 0 for n< 0 and n N . The N point discrete Fourier transform (DFT) is defined by X k = N -1 n=0 x[n]e -j 2πkn/N k =0, 1,...,N - 1. This can be viewed as sampling in the frequency domain (which is dual to sampling in the time domain). In chapter 8, we sampled a continuous time signal every T s seconds resulting in the discrete time signal x[n]= x(nT s ). Here we sample the continuous frequency function X (Ω) every 2π/N radians/sec. X k is the sample value at frequency k2π/N and is a function of discrete frequencies. That is, X k = X (Ω) for Ω = k2π/N . The DFT can be computed using the following MatLab function % % Discrete Fourier Transform % function Xk = dft(x) [N,M] = size(x); if M ~=1, % makes sure that x is a column vector x = x’; N = M; end Xk=zeros(N,1); n = 0:N-1; for k=0:N-1 Xk(k+1) = exp(-j*2*pi*k*n/N)*x; end The Fast Fourier Transform is an algorithm which calculates the discrete Fourier transform. But it does the calculations more efficiently. For textbook problems, the difference is negligible. The MatLab command fft(x) results in the same vector Xk. Example: x[n] = 1 for n =0, 1, 2,..., 2q and x[n] = 0 otherwise. The exact DTFT is X (Ω) = sin[(q + .5)Ω] sin(Ω/2) e jqω .

description

handout

Transcript of 315class40 Handout

EE 315 Class 40Discrete Fourier Transform and Fast Fourier Transform (FFT)

Let x[n] be a discrete-time signal with DTFT X(Ω). Since X(Ω) is a function ofthe continuous variable Ω, it cannot be stored in the memory of a computer unlessX(Ω) can be expressed in closed-form. Practical signals do not result in closed-forms.

Suppose x[n] is time-limited, i.e. x[n] = 0 for n < 0 and n ≥ N . The N pointdiscrete Fourier transform (DFT) is defined by

Xk =N−1∑n=0

x[n]e−j 2πkn/N k = 0, 1, . . . , N − 1.

This can be viewed as sampling in the frequency domain (which is dual to samplingin the time domain). In chapter 8, we sampled a continuous time signal every Ts

seconds resulting in the discrete time signal x[n] = x(nTs). Here we sample thecontinuous frequency function X(Ω) every 2π/N radians/sec. Xk is the sample valueat frequency k2π/N and is a function of discrete frequencies. That is, Xk = X(Ω)for Ω = k2π/N .

The DFT can be computed using the following MatLab function

%

% Discrete Fourier Transform

%

function Xk = dft(x)

[N,M] = size(x);

if M ~=1, % makes sure that x is a column vector

x = x’;

N = M;

end

Xk=zeros(N,1);

n = 0:N-1;

for k=0:N-1

Xk(k+1) = exp(-j*2*pi*k*n/N)*x;

end

The Fast Fourier Transform is an algorithm which calculates the discrete Fouriertransform. But it does the calculations more efficiently. For textbook problems, thedifference is negligible. The MatLab command fft(x) results in the same vector Xk.

Example: x[n] = 1 for n = 0, 1, 2, . . . , 2q and x[n] = 0 otherwise. The exact DTFTis

X(Ω) =sin[(q + .5)Ω]

sin(Ω/2)ejqω.

The inverse discrete Fourier transform is given by

x[n] =1

N

N−1∑k=0

Xkej 2πkn/N n = 0, 1, . . . , N − 1.

The inverse DFT can be computed using the following MatLab function

%

% Inverse Discrete Fourier Transform

%

function x = idft(Xn)

[N,M] = size(Xn);

if M ~= 1, % makes sure that Xn is a column vector

Xn = Xn.’;

N = M;

end

x=zeros(N,1);

n = 0:N-1;

for k=0:N-1

x(k+1) = exp(j*2*pi*k*n/N)*Xn;

end

x = x/N;

The inverse Fast Fourier Transform is an algorithm which calculates the inverseDFT more efficiently. Again, for textbook problems, the difference is negligible. TheMatLab command ifft(Xk) results in the vector x[n].

For a DT LTI system with DFT Hk. For an DT input with DFT Xk, the outputDFT is

Yk = HkXk.

2