Professional Documents
Culture Documents
Discrete Time Fourier Transform (DTFT) : Digital Signal Processing, © 2011 Robi Polikar, Rowan University
Discrete Time Fourier Transform (DTFT) : Digital Signal Processing, © 2011 Robi Polikar, Rowan University
Discrete Time Fourier Transform (DTFT) : Digital Signal Processing, © 2011 Robi Polikar, Rowan University
Fourier Transform
(DTFT)
Z Windows
Linear Phase
Bilinear. Tran.
Butterworth
Cascade
k T0 t0
-3 -2 -1 0 1 2 3
k
-1/2j RP
X X X
X e j
1
x(t ) X ()
1
X ()e jt d
2
Key Facts
to Remember
All FT pairs provide a transformation between time and frequency domains: The
frequency domain representation provides how much of which frequencies exist in
the signal More specifically, how much ejΩt exists in the signal for each Ω.
In general, the frequency representation is complex (except when the signal is even).
|X(Ω)|: The magnitude spectrum the power of each Ω component
Ang X(Ω): The phase spectrum the amount of phase delay for each Ω component
The FS is discrete in frequency domain, since it is the discrete set of exponentials –
integer multiples of Ω0 – that make up the signal. This is because only a finite
number of frequencies are required to construct a periodic signal.
The FT is continuous in frequency domain, since exponentials of a continuum of
frequencies are required to reconstruct a non-periodic signal.
Both transforms are non-periodic in frequency domain.
Digital Frequency
Recall that a discrete time signal can be obtained from a continuous time
signal through the process of sampling: take a sample every Ts second
* Remember: Continuous time complex exponentials are ALWAYS periodic with some fundamental frequency 0 –
unlike the discrete complex exponentials, which are only periodic for rational values of angular frequency
Digital Signal Processing, © 2011 Robi Polikar, Rowan University
Important Theorems
Theorem 1: The frequency response of the output of any system is
the product of the spectrum of the input signal and that of the
frequency response
Theorem 2: The DTFT of the impulse response is the frequency
response of the system.
Theorem 3: DTFT is periodic with 2π.
Theorem 4: The digital frequency 2π corresponds to the linear
sampling frequency of the signal.
Theorem 5: DTFT only exists for sequences that are absolutely
summable.
System Output
If x[n] is input to an LTI system with an impulse response of h[n],
then the DTFT of the output is the product of X(ω) and H(ω)
ejω0n h[n]
y[n] h[k ]e
k
j 0 nk
Quantity h[k ]e j0 k e j0n
k
independent of n
H(ω0)
y[n] H 0 e j0n
If the system input is a complex exponential at a specific frequency ω0, then the system
output is the same exponential, at the same frequency ω0 but weighted by a complex
amplitude that is a function of this input frequency. This complex amplitude, H(ω0), is
the DTFT of system impulse function h[n], evaluated at ω0 , and it is called the
frequency response of the system.
Frequency Response
This theorem constitutes the fundamental cornerstone for the concept
of frequency response. H(ω), the DTFT of h[n], is called the
frequency response of the system
Why is it important?
If a sinusoidal sequence with frequency 0 is applied to a system whose frequency
response is H(ω), then the output can be obtained simply by evaluating H(ω) at
ω = ω0.
Since all signals can be written as a superposition of sinusoids at different
frequencies, then the output to an arbitrary input can be obtained as the
superposition of H(ω) for each component ω0 that makes up the input signal!
Most importantly, this is cornerstone of filter design: If you want to design a filter
that blocks a certain frequency ωcut, then we design the system such that H(ωcut)=0;
and if we want the system to pass a certain frequency ωpass then we make sure that
H(ωpass)=1
A Simple
Filtering Example
Consider the ideal lowpass filter H(ω)
1
1, c
H
0, c -π -ωc ωc π ω
passband
Let‟s design a simple lowpass FIR filter that blocks frequencies above
0.7π, but passes the frequencies below 0.2π perfectly.
We want our filter to be as simple as possible, so let’s assume that we have length
3, symmetric impulse response filter. That is, h[0]=h[2]=1 , and h[1]= 2.
Then our filter should have a frequency response of the form
H h 0 e j 0 h 1 e j1 h 2 e j 2
1 2 e j 1e j 2 1 1 e j 2 2 e j
2
e j
e j
e j 2 e j 21 cos 2 e j
1
2
cos
0.8
0.6
H(0.7π)=0
0.4
0.2
RP
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Angular Frequency /
Periodicity of DTFT
Theorem 3:
The DTFT of a discrete sequence is periodic with the period 2π, that is
X() X( 2 k ) for any integer
n
x n e j n j 2k n
x n e X
j n
e
n n
Why…?
Implications of the
Periodicity Property
H H 2
grid
-5
title('Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)')
xlabel('Time, s') -10
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
subplot(212) Time, s
f=-499.9:1000/2001:500; 3000
plot(f,X2);
2000
grid
title(' Frequency domain representation of 1000
Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)') xlabel RP
0
('Frequency, Hz.') -500 -400 -300 -200 -100 0 100 200 300 400 500
Frequency, Hz.
Understanding the
Periodicity of the DTFT
Sin(220t)+4Cos(2 50t)+2Sin(2100t)
10
1000
FFT computes the FT at the same N number RP
of points as the length of the originl signal 0
0 500 1000 1500 2000 2500
with the assumption that the frequency Normalized Frequency
range is one period of [0 2π]. Then, sample
1 of the FFT corresponds to frequency 0,
What do these mean?
and sample N corresponds to frequency 2π
(which is the sampling frequency).
Sin(220t)+4Cos(250t)+2Sin(2100t)
10
X x n e
n
j n
x n e
n
j n
x n
n
Hence, if x[n] is absolutely summable, then |X(ω)|is finite, which means that X(ω)
exists.
We should add that this is sufficient, but not required to have a DTFT. Certain
sequences that do not satisfy this requirement also have DTFTs, if they satisfy
“mean square convergence.” These will be discussed later within z-transform.
Important DTFT Pairs
Impulse Function
The DTFT of the impulse function is “1” over the entire frequency
band.
[n] 1
n n e
j n j 0n
1 e 1
n
Summations terms are all zero,
except for n=0
x[n] X(ω)
[n] DTFT 1
n -π π RP ω
x=zeros(1000,1);
x(500)=1; 0.5
subplot(211)
plot(x); grid
title('Original unit delta sequence \delta[n]')
0
X=abs(fft(x)); 0 100 200 300 400 500 600 700 800 900 1000
subplot(212)
Magnitude spectrum
w=-pi:2*pi/999:pi; 1
plot(w/pi, fftshift(X)); grid
title('Magnitude spectrum')
1
xlabel('Angular Frequency (x \pi)')
1
RP
1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Angular Frequency (x )
In class Demo
1.5
x=ones(1000,1); 0.5
subplot(211)
plot(x); grid 0
title('Original constant sequence') 0 100 200 300 400 500 600 700 800 900 1000
X=abs(fft(x));
Magnitude spectrum
subplot(212) 1000
w=linspace(-pi, pi, 1000);
800
plot(w/pi, fftshift(X)); grid
title('Magnitude spectrum') 600
xlabel('Angular Frequency (x \pi)') 400
RP
200
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Angular Frequency (x )
Important DTFT Pairs
The Complex Exponential
The DTFT of the complex exponential:
x[n] e j0 X 2
k
0 2 k
X e 1
n
n j n j
e
n 0 n 0 1 e j
In Matlab
This is an important function in signal processing. Why?
1
x[n] u[n]
n
1 e j
t=0:0.01:10;
x=(0.5).^t;
plot(t,x)
X=fftshift((fft(x)));
subplot(311)
plot(t,x); grid
subplot(312)
plot(abs(X)); grid
f=-50:100/1000:50;
plot(f,abs(X)); grid
RP
subplot(313)
plot(f, unwrap(angle(X))); grid
DTFT
0.8
0.4
0.2
... ...
-0.2
-0.4
-0.6 RP
π 2π
-0.8
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-2π -π - ω0 ω0 ω
1, M n M
x[n] rect M [n]
0, otherwise
M sin M 1 2
e jn sin 2
, 0
nM
1, c
H
0, c
Taking its inverse DTFT, we can obtain the corresponding impulse function h[n]:
c
1 1
1 e 1 e
j n j n
h[n] d d
2
2 c
sin c n
, n
1 e jc n
e n jc n
2 jn jn c
, n0
Ideal Lowpass Filter
Note that:
The impulse response of an ideal LPF is infinitely long This is an IIR filter. In
fact h[n] is not absolutely summable its DTFT cannot be computed an ideal
h[n] cannot be realized!
One possible solution is to truncate h[n], say with a window function, and then
take its DTFT to obtain the frequency response of a realizable FIR filter.
How does this code work?
(Carefully analyze at home)
Ideal_lpf_by_sinc.m
%This function creates an ideal LPF in frequency domain and then computes
its inverse Fourier transform.
%Robi Polikar, Feb 12 2007
Clear; close all
L=input('Enter the length of the frequency vector: L= ');
wc=input('Enter the LPF corner frequency in rad (times pi): wc= ')
%These values create good looking graphs L=128; wc=0.25*pi; Magnitude spectrum of LPF with cutoff frequency =0.2 rad
w=linspace(-pi, pi, L); t=linspace(-0.5,0.5,L); c
%Create a LPF with a cutoff frequency of wc 1
H=zeros(L,1);
H(L/2-round(wc*(L/2)/pi): L/2+round(wc*(L/2)/pi))=1;
Ideal LPF defined in frequency domain 0.5
subplot(311); plot(w/pi, H); grid
xlabel('Angular frequency, x\pi') 0
Wc=wc/pi; %Convert to a multiple of pi -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
title(['Magnitude spectrum of LPF with cutoff frequency \omega_c =', … Angular frequency, x
num2str(Wc), '\pi rad']);
Inverse FT --> impulse response of H()
H=fftshift(H); %This is necessary to reset H into the [0 2pi] range as
%expected by Matlab 0.2
h=real(ifft(H)); h=fftshift(h);
subplot(312); plot(t, h); grid 0.1
axis([t(1) t(L) 0.8*min(h) 1.2*max(h)])
0
xlabel('Time, s.')
title('Inverse FT --> impulse response of H(\omega)') -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5
Time, s.
n=-L/2:L/2;
h_alt=sin(wc*n)./(pi*n);
Ideal LPF defined in time domain impulse response of H() computed analytically
if (rem(L,2)== 0)
0.2
end
h_alt(round(L/2)+1)=wc/pi; RP
0.1
subplot(313)
plot(n,h_alt); grid 0
axis([-L/2 L/2 0.8*min(h_alt) 1.2*max(h_alt)]) -60 -40 -20 0 20 40 60
xlabel('Time index n') Time index n
title('impulse response of H(\omega) computed analytically')
Some Useful
Matlab Functions
Matlab cannot explicitly calculate the DTFT, since the frequency axis is continuous.
However, it can calculate an approximation of the DTFT using a given number of points.
y=fft(x, N) – Calculates the discrete Fourier transform of the signal x at N points. If N is not
provided, length of y is the same as x. DFT is a sampled version of the DTFT, where the
samples are taken at N equidistant points around the unit circle from 0 to 2π.
[h,w] = freqz(b,a,N,'whole') – Calculates the frequency response of a filter whose CCLDE
coefficients are given as b and a, using N number of points around the unit circle. If „whole‟
is included, it returns a frequency base of w from 0 to 2π, otherwise, from 0 to π.
y=abs(x)- Calculates the absolute value of signal x. For complex values signals, the output is
the magnitude (spectrum) of the complex argument.
y=angle(x) – Calculates the phase (spectrum) of the signal x.
q = unwrap(p) corrects the radian phase angles in a vector p by adding multiples of 2π when
absolute jumps between consecutive elements of p are greater than the default jump tolerance
of π radians.
y = fftshift(x) rearranges the outputs of fft by moving the zero-frequency component to the
center of the array. It is useful for visualizing a Fourier transform with the zero-frequency
component in the middle of the spectrum. It changes the default [0 2π] range to [-π π]
Other Important
Properties of DTFT
We will study the following properties of the DTFT:
Linearity DTFT is a linear operator
Time reversal x[-n] X(-ω)
Time shift x[n-n0] X(ω)e-jωn0
Frequency shift x[n] ejω0n X(ω-ω0)
Convolution in time x[n]*y[n] X(ω).Y(ω)
Convolution in frequency
Differentiation in frequency nx[n] j (dX(ω)/dω)
Parseval’s theorem Conservation of energy in time and frequency domains
Symmetry properties
x[n] X ( ) y[n] Y ( )
Linearity &
Time Reversal
Given x(t) and X(ω) form a DTFT pair, x n X we can show that
A reversal in of the time domain variable causes a reversal of the frequency variable
x n X
Proof:
X n x n e jn , if y n x n
Y n y n e jn n x n e jn m x m e j m
X
m
Time & Frequency Shift
A shift in time domain by m samples causes a phase shift of e-jωm in the frequency
domain
x n M X e jM , M
y k x n M Y x n M e j n
x k e j k M
k nM
n n k M k
j k
x k e
k
j k
e j M
e j M
k
x k e X e
j M
y k x n M Y X Why not?
To compute the spectrum of the output, Y(ω), let’s take the DTFT of both sides.
Assuming that X(ω) and Y(ω) exist, and using the linearity and time shifting
properties, we have
Y h k X e jk
k
Now, since we know that in frequency domain, the output Y(ω) = H(ω). X(ω), we
have H
h k e jk
k
proving that the frequency response of the system is indeed the DTFT of the
impulse response h[n].
Importance of the Linearity &
Time Shift Properties
Frequency Response of IIR Systems
Consider the CCLDE of a typical LTI system:
N 1 M 1
a y[n i]
i 0
i
0
b x[n j ], a0 1
y[n] a1 y[n 1] a2 y[n 2] aN 1 y n N 1 b0 x[n] b1x[n 1] bM 1x n M 1
M 1
Y j1 j M 1 j k
b0 b1e bM 1e b e
H k 0 k
1
Let x n a nu n X
1 ae j
dX 1
y n nx n x n Y j X
d
2
1 ae j
Convolution in Time
Convolution in time domain is equivalent to multiplication in
frequency domain
x n h n X H
Proof: Let y[n]=x[n]*h[n], then we need to prove that Y(ω)=X(ω)H(ω)
y n x n h n x k h n k
k
Y y n y n e j n
x k h n k e j n
n n k
mnk x k h me
m k
j m k
x k h m e j m e j k
k m
H
x k H e j k
x k e j k H X H
k k
This is one of the fundamental theorems in DSP. It allows us to compute the
filter response in frequency domain using the frequency response of the filter.
Convolution in Frequency
(Modulation)
Multiplication in time domain is equivalent to convolution integral in
frequency domain
1
x n h n X H d
2
1
x n X
2 2
d
n 2 Energy density spectrum
of the signal
Alternatively:
1
x n y n
X Y d
n 2
Symmetry Properties
of DTFT
Your text lists several symmetry properties of DTFT
While all of these properties are important for academic reasons, the following are
important for practical reasons:
• The Fourier transform of a real signal is conjugate symmetric: the magnitude spectrum
is an even function of ω (symmetric), whereas the phase spectrum is an odd function
of ω (antisymmetric). That is, for a real signal x[n]
X * X * X X , X X
x n
X X real jX imag
then, the following is true:
The analysis equation is an infinite sum. In reality, we cannot deal with the
infinitely long signals (particularly using computers), as we do not have infinite
memory. Hence, we usually have a finite length signal, say of N samples, in which
case the DTFT becomes:
N 1
1
X x n e j n
x n
2
X e jn
d , 0 n N 1
n 0
…but then, it is obvious that the larger N, the larger number of components are
used to make up X(ω), and hence the more accurate X(ω) becomes. We will see
that the limitation that we can only use a finite number of samples will create some
artifacts in the spectrum
Resolution of
the DTFT
Consider the following three sinusoids, all at the same (some angular) frequency of
π/2, and their corresponding spectra: 6
Spectrum of x [n] 1
4
%four time bases of length 10, 20 and 40 and 100 2
t1 = 0:9;
t2 = 0:19; 0
t3 = 0:39; -1 -0.5 0 0.5 1
t4 = 0:99; Spectrum of x2[n]
10
%Create frequency base of 1024 points between +/- pi
w = linspace(-pi, pi, 1024);
omega=pi/2; %Common frequency for all four signals 5
Spectral Amplitude
x1=cos(omega*t1); x2=cos(omega*t2);
x3=cos(omega*t3); x4=cos(omega*t4); 0
-1 -0.5 0 0.5 1
Spectrum of x3[n]
%Compute 1024 point FFTs 20
X1 = fftshift(abs(fft(x1, 1024)));
X2 = fftshift(abs(fft(x2, 1024)));
X3 = fftshift(abs(fft(x3, 1024))); 10
X4 = fftshift(abs(fft(x4, 1024)));
0
-1 -0.5 0 0.5 1
subplot(411); plot(w/pi, X1); title('Spectrum of x_1[n]'); grid Spectrum of x4[n]
50
subplot(412); plot(w/pi, X2); title('Spectrum of x_2[n]'); grid
subplot(413); plot(w/pi, X3); title('Spectrum of x_3[n]'); grid
subplot(414); plot(w/pi, X4); title('Spectrum of x_4[n]'); grid 30
xlabel('Normalized frequency -\pi to \pi') RP
10
0
-1 -0.5 0 0.5 1
Normalized frequency - to
Frequency Resolution
of the DTFT
Observe the following: 6
Spectrum of x1[n]
4
While the peak spectral component is correctly 2
4
0
sharp there appears to be other frequencies: -0.8 -1 -0.7 -0.6
-0.5 -0.5 0 -0.4
Spectrum of x2[n]
-0.3
0.5 -0.2 1
10
• These are also due to using a finite length 8
signal, which can be interpreted as windowing 6
5
with a rectangular function (more on this later) 4
Spectral Amplitude
2
• Gibbs’ phenomenon 0 0
-1 -0.5 0 0.5 1
-0.7 -0.65 -0.6 -0.55 -0.5 -0.45 -0.4 -0.35 -0.3
• These are artifacts – these frequencies do not 20
Spectrum of x3[n]
- to-0.44
of side lobes but with narrower width for Normalized
-0.58 -0.56 -0.54 -0.52 frequency
-0.5 -0.48 -0.46 -0.42 -0.4
each.
What did we
learn this week?
The Discrete Time Fourier Transform
Definition
Key theorems
• DTFT of the output of an LTI system
• The frequency response my first filter : Hello filter
• Periodicity of DTFT
• Definition of discrete frequency
• Existence of DTFT
DTFTs of some important sequences
DTFT properties
• Linearity and time reversal
• Time and frequency shifting
• Differentiation, convoltion, symmetry properties
• Parseval’s theorem
• The resolution of the DTFT
DTFT in Matlab