48
Discrete Time Fourier Transform (DTFT)

Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

  • Upload
    buique

  • View
    258

  • Download
    13

Embed Size (px)

Citation preview

Page 1: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Digital Signal Processing, © 2011 Robi Polikar, Rowan University

Discrete Time Fourier Transform

(DTFT)

Charay
Stamp
Page 2: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

DSPSignals

Sinusoids &

Exponentials

Impulse, step,

rectangular

Phasors

Frequency

Characterization

Time domain

representation

Representation in

frequency domain

Spectrum

Power / Energy Periodicity Cont. / Discrete

Convolution

Regular / Circular

Sampling

Nyquist Thm.

CFT

Transforms

ZPoles & Zeros

ROC

DFTDTFT FFT

(LTI) Systems

Discrete LTI

Systems

Classification

Impulse Resp.

Linearity

Time Inv.

Causality Memory

Stability

Time Domain Rep.

Diff. Equation

Ideal vs. Practical

Freq. Domain Rep.

Filtering

LPF HPF BPF BSF APF Notch

FIR / IIR

Filter Design

FIR IIR

Windows

Linear Phase

Specs

Bilinear. Tran.

Butterworth

Chebychev

Elliptic

Stability

Filter Structure

FIR IIR

Direct

Cascade

Lattice

Transfer Func.

Frequency Res.

Quantization

Finite

Worldlength

A/D D/A

Number Rep.

Fixed/Floating

Quantization

Noise

Overflow

Effects

Advanced Topics

Random Signal Analysis

Multirate Signal Proc.

Time Frequency Analysis

Adaptive Signal Process.

RP

Page 3: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

This Week in DSP

The Discrete Time Fourier Transform

Definition

Key theorems

• DTFT of the output of an LTI system

• The frequency response

• Periodicity of DTFT

• Definition of discrete frequency

• Existence of DTFT

DTFTs of some important sequences

DTFT properties

DTFT in Matlab

Page 4: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Fourier Series and

Fourier Transform

Any periodic signal x(t), with fundamental period is T0, can be represented as a finite

and discrete sum of complex exponentials (sines and cosines) that are integer

multiples of Ω0, the fundamental frequency: FOURIER SERIES

A non-periodic continuous time signal can

also be represented as an (infinite and

continuous) sum of complex exponentials: FOURIER TRANSFORM

k

ktjkectx 0)(

00

0

0)(1

0

Tt

t

tjkk dtetx

Tc

1

( ) ( )

1( ) ( ) ( )

2

j t

j t

X x t x t e dt

x t X X e d

k

ck

1 2 3-1-2-3 0

1/2j1/2 1/2

-1/2j

jeX

XXX

( )x t XF

RP

Page 5: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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.

Page 6: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

the discrete signal, ω, is 2π. While counterintuitive, ω is NOT discrete in frequency! ,

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

When time is discretized, what happens to frequency? Consider the following: (where we use Ω to represent continuous frequency, and ω to represent discrete frequency)

Note that when Ω=Ωs ω = ωs= 2π What does this mean?

,2,1,0,1,2,)()()(

ntxnTxnxsnTts

( ) sin( )

( ) sin( )s s s

y t A t

y nT A T n

sss

F

FfT

2

Sampling frequency (rad/s) Sampling frequency (sam/s)

Spectrum of discrete signals – by definition – is normalized with respect to sampling frequency. If the analog frequency is equal to the sampling frequency, the corresponding frequency of

Digital frequency Analog frequency

2s

F

F

Page 7: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Discrete –Time

Fourier Transform (DTFT)

Similar to continuous time signals, discrete time sequences can also be periodic or

non-periodic, resulting in discrete-time Fourier series or discrete – time Fourier

transform, respectively.

Most signals in engineering applications are non-periodic, and DTFS is really a

special case of DTFT, so we will concentrate on DTFT.

We will represent the discrete signal‟s frequency as ω, measured in radians/sample.

)(][ Xnx

1[ ] ( )

2

( ) [ ]

j n

j n

n

x n X e d

X x n e

Quick facts:

• Since x[n] is discrete, we can only add them, summation in theanalysis equation. ejωn, however, is continuous function for each n

• The sum of x[n], weighted with continuous exponentials ejωn, is

continuous the DTFT X(ω) is continuous (non-discrete)

• Since X(ω) is continuous, x[n] is obtained as a continuous integral

of X(ω), weighed by the same complex exponentials.

• x[n] is obtained as an integral of X(ω), where the integral is over

an interval of 2π. This is our first clue that DTFT is periodic

with 2π in frequency domain.

• X(ω) is sometimes denoted as X(ejω) or X(jω) in some books, including

yours. While X(ejω) is more accurate, we will use X(ω) for brevity.

• The ∞ indicates that the sum is simply over all available samples!

2 sf f

Page 8: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Digital Signal Processing, © 2011 Robi Polikar, Rowan University

Proof

We now show that x[n] and X(ω) are indeed FT pairs, that is one can

be obtained from the other:

Lemma: complex exponentials* are orthogonal, that is

j n

n

X x n e

1

2

j nx n X e d

1

2

j j nx n x e e d

0

0 ( )

0

0

0,[ ]

,

t T

j k m t

t

k me dt T k m

T k m

Integral over

one period

* 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

Analysis Equation Synthesis Equation

( )0,

2 [ ]2 ,

j n ln l

e d n ln l

Time domain case

Frequency domain case

Page 9: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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.

Page 10: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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(ω)

x[n] y[n]=x[n]*h[n]h[n]

X(ω) Y(ω) = X(ω) . H(ω)H(ω)

RP

Page 11: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Theorem 2:

If the input to an LTI system with an impulse response of h[n] is a complex

exponential ej0n , then the output is the SAME complex exponential whose

magnitude and phase are given by |H(ω)| and <H(ω), evaluated at ω = ω0.

Frequency Response

h[n]ejω0n 0

0 0

[ ] [ ]

[ ]

j n k

k

j k j n

k

y n h k e

h k e e

H(ω0)

0

0[ ]j n

y n H e

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.

Quantity independent of n

Page 12: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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

Page 13: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

A Simple

Filtering Example

Consider the ideal lowpass filter

We apply an input, , which has

two frequency components in it, ω1 that falls within the passband of our filter, and

ω2 that falls outside of the passband.

According to Theorem 2, the output will be at the same frequencies, but multiplied

by a constant specified by the frequency response of the system, evaluated at those

frequencies.

c

cH

,0

,1

H(ω)

ω-ωc ωc

1

1 1 2 2 1 2cos cos , 0x n C n C n

-π πpassband

1 1 1 2 2 2 1 1 1

0

cos cos cosy n H C n H C n H C n

(why is this an approximation,but not an equality?)

The output does not include the frequency ω2 , i.e., it is filtered out.

Page 14: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Hello Filter(My First Filter Design)

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

We want H(0.2π)=1, and H(0.7π)=0. Furthermore, right now, we are primarily

concerned with the magnitude and not phase. Plugging these values into H(ω),

0 1 2

2 2

1 2 1 1 2

1 2 1 2

cos

0 1

22

2

1

2 cos

j j j

j j j j

j j

jj j

H h e h e h e

e e e

e

e

e ee e

1

0.2

11 2 1 2

0.72

1 2 1 2

1

0.3580,0.2 2 cos 0.2 1 2 cos 0.2 1

0.4208.0.7 2 cos 0.7 0 2 cos 0.7 0

magnitude

j

j

magnitude

H e

H e

Page 15: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Hello FilterDid My First Filter Work?

b=[0.3580 0.4208 .3580];a=1;[H w]=freqz(b,a, 1024);plot(w/pi, abs(H))gridxlabel('Normalized Angular Frequency / \pi ')ylabel('Magnitude Frequency Response')

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.2

0.4

0.6

0.8

1

1.2

1.4

Normalized Angular Frequency /

Ma

gn

itu

de

Fre

qu

en

cy

Re

sp

on

se

H(0.2π)=1

H(0.7π)=0

RP

Page 16: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Periodicity of DTFT

Theorem 3:

The DTFT of a discrete sequence is periodic with the period 2π, that is

X( ) X( 2 ) for any integer k

The periodicity of DTFT can be easily verified from the definition:

j n

n

X x n e

2

2

2 [ ]j k n

n

j k n j nj n

n n

X k x n e

x n e e x n e X

Why…?

Page 17: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Implications of the

Periodicity Property

2H H

Theorem 4 (You-will-flunk-if-you-do-not-understand-this-fact theorem):

The discrete frequency 2π rad. corresponds to the sampling frequency Ωs used to

sample the original continuous signal x(t) to obtain x[n].

Proof: sin sins sx t A t x nT A T n

ω=ΩTs For Ω= Ωs, we have ω=ΩsTs=2πfsTs=2π

Page 18: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Understanding the

Periodicity of the DTFT

Recall the following example

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2-10

-5

0

5

10 Sin(220t)+4Cos(250t)+2Sin(2100t)

Time, s

-500 -400 -300 -200 -100 0 100 200 300 400 5000

1000

2000

3000

4000 Frequency domain representation of Sin(220t)+4Cos(250t)+2Sin(2100t)

Frequency, Hz.

t=0:0.001:2; % sampling frequency = 1000Hz

x=sin(2*pi*20*t)+4*cos(2*pi*50*t)+2*sin(2*pi*100*t); subplot(211)

plot(t(1:200),x(1:200))

grid

title('Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)') xlabel('Time, s')

subplot(212)

X=abs(fft(x));

X2=fftshift(X);

f=-499.9:1000/2001:500;

plot(f,X2);

grid

title(' Frequency domain representation of

Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)') xlabel

('Frequency, Hz.')

RP

Page 19: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Understanding the

Periodicity of the DTFT

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2-10

-5

0

5

10

Sin(220t)+4Cos(250t)+2Sin(2100t)

Time, s

0 500 1000 1500 2000 25000

1000

2000

3000

4000 Frequency domain representation of Sin(220t)+4Cos(250t)+2Sin(2100t)

Normalized Frequency

t=0:0.001:2; %Sampling frequency = 1000Hz% Note that the length of the signal is 2001 samples.x=sin(2*pi*20*t)+4*cos(2*pi*50*t)+2*sin(2*pi*100*t);subplot(211)plot(t(1:200),x(1:200)) %plot a portion of the signalgridtitle('Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)')xlabel('Time, s')subplot(212)X=abs(fft(x));plot(X)gridtitle(' Frequency domain representation of Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)')xlabel('Normalized Frequency')

What do these mean?

FFT computes the FT at the same N number of points as the length of the originl signal with the assumption that the frequency range is one period of [0 2π]. Then, sample 1 of the FFT corresponds to frequency 0, and sample N corresponds to frequency 2π(which is the sampling frequency).

RP

Page 20: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

0 0.05 0.1 0.15 0.2-10

0

10Sin(220t)+4Cos(250t)+2Sin(2100t)

Time, s

0 500 1000 1500 2000 25000

2000

4000 Frequency domain representation of Sin(220t)+4Cos(250t)+2Sin(2100t)

Normalized Frequency

0 500 1000 1500 2000 25000

2000

4000

Normalized Frequency

-500 -400 -300 -200 -100 0 100 200 300 400 5000

2000

4000

Frequency, Hz.

t=0:0.001:2; %Sampling frequency = 1000Hzx=sin(2*pi*20*t)+4*cos(2*pi*50*t)+2*sin(2*pi*100*t);subplot(411)plot(t(1:200),x(1:200)) %plot a portion of the signalgridtitle('Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)')xlabel('Time, s')subplot(412)X=abs(fft(x));%Take the DFT(FFT)plot(X) % Plots X in the default [0 2π] rangegridtitle(' Frequency domain representation of Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)')subplot(413)X2=fftshift(X); % Flip the FT so that 0 frequency is at the center, and the

% frequency range is now [-π π] instead of [0 2π]

plot(X2)gridtitle(' Frequency domain representation of Sin(2\pi20t)+4Cos(2\pi50t)+2Sin(2\pi100t)')subplot(414)f=-499.9:1000/2001:500; %Create frequency axis to plot -500 to 500 Hzplot(f,X2);gridxlabel('Frequency, Hz.') RP

Page 21: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Existence of DTFT

Theorem 5:

The DTFT of a sequence exists if and only if, the sequence x[n] is absolutely

summable, that is, if

because:

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.

n

nx ][

j n j n

n n n

X x n e x n e x n

This quantity is always ≤ 1

Page 22: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Important DTFT Pairs

Impulse Function

The DTFT of the impulse function is “1” over the entire frequency

band. 1][ n

Extend of the frequency band

in discrete frequency domain

01 1j n j n

n

n n e e

Summations terms are all zero,

except for n=0

[n]

n

x[n] X(ω)

ω

1DTFT

-π π RP

Page 23: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Important DTFT Pairs

Constant Function

Note that x[n]=1 (or any other constant) does not satisfy absolute

summability. However, we can show that the DTFT of the constant

function is an impulse at ω=0. (this should make sense!!!)

m

m 221 j n

n

X x n e

Cannot use

We can show that this transformation is correct, by computing the inverse DTFT of the above function

1 012 2 2 2 1

2

j n j n

m m

m m e d e

n

x[n]X(ω)

ω

2π(ω)

DTFT

-2π 2π

2π(ω-2π)2π(ω+4π)

-4π 4π-π π

RP

Page 24: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Matlab Approximation

In class demo!

x=zeros(1000,1);

x(500)=1;

subplot(211)

plot(x); grid

title('Original unit delta sequence \delta[n]')

X=abs(fft(x));

subplot(212)

w=-pi:2*pi/999:pi;

plot(w/pi, fftshift(X)); grid

title('Magnitude spectrum')xlabel('Angular Frequency (x \pi)')

0 100 200 300 400 500 600 700 800 900 10000

0.5

1Original unit delta sequence [n]

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 11

1

1

1Magnitude spectrum

Angular Frequency (x )

RP

Page 25: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

In class Demo

x=ones(1000,1);

subplot(211)

plot(x); grid

title('Original constant sequence')

X=abs(fft(x));

subplot(212)

w=linspace(-pi, pi, 1000);

plot(w/pi, fftshift(X)); grid

title('Magnitude spectrum')xlabel('Angular Frequency (x \pi)')

0 100 200 300 400 500 600 700 800 900 10000

0.5

1

1.5

2Original constant sequence [n]

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 10

200

400

600

800

1000Magnitude spectrum

Angular Frequency (x )

RP

Page 26: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Important DTFT Pairs

The Complex Exponential

The DTFT of the complex exponential:

0

0[ ] 2 2j

k

x n e X k

ω0 ω0+2π ω0+4πω0-4π ω0-2π

. . . . . .

We are only interested in

[- π π] range, where there is

only one spectral component

Hence, the spectrum of a single

complex exponential at a specific

frequency is an impulse at that

frequency.

This can be verified by computing

the inverse DTFT of X(ω) given

above, as in the previous example.

RP

Page 27: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Important DTFT Pairs

Real Exponential

j

n

enunx

1

1][][

0 0

1

1

nn j n j

jn n

X e ee

Page 28: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

In Matlab

This is an important function in signal processing. Why?

j

n

enunx

1

1][][

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

subplot(313)

plot(f, unwrap(angle(X))); grid

In Matlab, periodicity of X(ω) is assumed

RP

Page 29: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Important DTFT Pairs

The sinusoid at ω=ω0

By far the most often used DTFT pair (it is less complicated then it looks):

mm

mmnnx 000 22cos][

00[ ] 2 2

j n

m

x n e m

The above expression can also be obtained

from the DTFT of the complex exponential

through the Euler’s formula.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

(ω+ ω0)

ω

X(ω)

(ω- ω0)

ω0- ω0

DTFT

Cos (ω0t)

. . .. . .

-2π 2π-π π

RP

Page 30: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Important DTFT Pairs

Rectangular Pulse

Rectangular pulse train is also very commonly used in DSP (it is the

moving average filter).

What if we change the order?

Whose Fourier transform would

be a rectangular pulse (which

of course is ideal LPF)

0,2sin

21sin

otherwise,0

,1][rect][

Me

MnMnnx

M

Mn

nj

M

RP

Page 31: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Ideal Lowpass Filter

The ideal lowpass filter is defined as

Taking its inverse DTFT, we can obtain the corresponding impulse function h[n]:

c

cH

,0

,1

1 1[ ] 1 1

2 2

sin,

1

2, 0

c

c

c c

j n j n

cj n j n

c

h n e d e d

nn

e e n

jn jnn

Page 32: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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.

Page 33: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

How does this code work?(Carefully analyze at home)

%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;

w=linspace(-pi, pi, L); t=linspace(-0.5,0.5,L);

%Create a LPF with a cutoff frequency of wc

H=zeros(L,1);

H(L/2-round(wc*(L/2)/pi): L/2+round(wc*(L/2)/pi))=1;

subplot(311); plot(w/pi, H); grid

xlabel('Angular frequency, x\pi')

Wc=wc/pi; %Convert to a multiple of pi

title(['Magnitude spectrum of LPF with cutoff frequency \omega_c =', …

num2str(Wc), '\pi rad']);

H=fftshift(H); %This is necessary to reset H into the [0 2pi] range as

%expected by Matlab

h=real(ifft(H)); h=fftshift(h);

subplot(312); plot(t, h); grid

axis([t(1) t(L) 0.8*min(h) 1.2*max(h)])

xlabel('Time, s.')

title('Inverse FT --> impulse response of H(\omega)')

n=-L/2:L/2;

h_alt=sin(wc*n)./(pi*n);

if (rem(L,2)== 0)

h_alt(round(L/2)+1)=wc/pi;

end

subplot(313)

plot(n,h_alt); grid

axis([-L/2 L/2 0.8*min(h_alt) 1.2*max(h_alt)])

xlabel('Time index n')

title('impulse response of H(\omega) computed analytically')

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 10

0.5

1

Angular frequency, x

Magnitude spectrum of LPF with cutoff frequency c =0.2 rad

-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5

0

0.1

0.2

Time, s.

Inverse FT --> impulse response of H()

-60 -40 -20 0 20 40 60

0

0.1

0.2

Time index n

impulse response of H() computed analytically

Ideal_lpf_by_sinc.m

RP

Ideal LPF defined in frequency domain

Ideal LPF defined in time domain

Page 34: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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 [-π π]

Page 35: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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

)(][ Xnx

)(][ Yny

Page 36: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Linearity &

Time Reversal

Given x(t) and X(ω) form a DTFT pair, we can show that

The DTFT is a linear operator

A reversal in of the time domain variable causes a reversal of the frequency variable

ax n by n aX bY

x n X

x n X

,j n

n

j n j n j m

n n mm

X x n e if y n x n

Y y n e x n e x m e X

Proof:

Page 37: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Time & Frequency Shift

A shift in time domain by m samples causes a phase shift of e-jωm in the frequency

domain

Note that the magnitude spectrum is unchanged by time shift.

Similarly, a shift in frequency domain by ω0 causes a time delay of ejω0n

,j Mx n M X e M

00

jx n e X

j k Mj n

k n Mn kn k M

j k j M j M j k j M

k k

y k x n M Y x n M e x k e

x k e e e x k e X e

y k x n M Y X Why not?

Page 38: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Importance of the Linearity &

Time Shift Properties

Frequency Response of FIR Systems

Here is another way to show that the frequency response of a system,

whose impulse response is h[n], is in fact H(ω)=F{h[n]}

Given the impulse response h[n] of an FIR system, the output y[n] to the input

x[n] is of course the convolution sum

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

Now, since we know that in frequency domain, the output Y(ω) = H(ω). X(ω), we

have

proving that the frequency response of the system is indeed the DTFT of the

impulse response h[n].

k

y n h k x n k

j k

k

Y h k X e

j k

k

H h k e

Page 39: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Importance of the Linearity &

Time Shift Properties

Frequency Response of IIR Systems

Consider the CCLDE of a typical LTI system:

The linearity of DTFT allows us to compute the DTFT of the entire

expression, by computing the DTFTs of the individual terms, and then

combine them:

1 1

0

0 0

[ ] [ ], 1N M

i

i

a y n i b x n j a

1 2 1 0 1 1[ ] [ 1] [ 2] 1 [ ] [ 1] 1N My n a y n a y n a y n N b x n b x n b x n M

11 2

1 2 1

11 2

0 1 2 1

1 11 1

1 1 0 1 1

11

0 1 1

11

1 1

1

1

j Nj j

N

j Mj j

M

j N j Mj j

N M

j MjkM

j Nj

N

Y a Y e a Y e a Y e

b X b X e b X e b X e

Y a e a e X b b e b e

bY b b e b eH

X a e a e

1

0

1

0

M j k

k

N j k

kk

e

a e

Page 40: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Differentiation in Frequency

Multiplying the time domain signal with the independent time variable

is equivalent to differentiation in frequency domain.

Example: What is the DTFT of

d

dXjnnx

)(][

1 ny n n a u n

2

1

1

1

1

n

j

j

Let x n a u n Xae

dXy n nx n x n Y j X

d ae

Page 41: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Convolution in Time

Convolution in time domain is equivalent to multiplication in

frequency domain

Proof: Let y[n]=x[n]*h[n], then we need to prove that Y(ω)=X(ω)H(ω)

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.

x n h n X H

m

k

j n j n

n n

j

k

j m j

k

m n k

k

H

k m

j k j k

k k

k

m

x k h n

y n x n

m

h n x k h n k

Y y n y n e e

x k h e

x

k

k h m e e

x k e x k e HH X H

Page 42: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Convolution in Frequency

(Modulation)

Multiplication in time domain is equivalent to convolution integral in

frequency domain

This property is also called the modulation theorem, since it involves

the modulation of one signal x[n] with the other h[n].

Recall our discussion on the meaning of signal and system. Here, h[n] can be

considered as another signal.

1

2x n h n X H d

Page 43: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Parseval’s Theorem

The energy of the signal , whether computed in time domain or the frequency

domain, is the same!

Alternatively:

2 21

2n

x n X d

Energy density spectrum

of the signal

1

2n

x n y n X Y d

Page 44: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (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]

• The Fourier transform of a symmetric signal is real! More generally, if

then, the following is true:

since the even part of any signal is necessarily symmetric, it follows that the DTFT of

any symmetric signal must also necessarily be real!

Symmetry Properties

of DTFT

* * ,X X X X X X

real imagx n X X jX

,even real odd imagx n X x n X

Page 45: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Resolution of

the DTFT

Recall the definition of the DTFT:

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:

…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

1

2

j n j n

n

X x n e x n X e d

1

0

1, 0 1

2

Nj n j n

n

X x n e x n X e d n N

Page 46: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Resolution of

the DTFT

Consider the following three sinusoids, all at the same (some angular) frequency of

π/2, and their corresponding spectra:

-1 -0.5 0 0.5 10

2

4

6Spectrum of x

1[n]

-1 -0.5 0 0.5 10

5

10Spectrum of x

2[n]

-1 -0.5 0 0.5 10

10

20Spectrum of x

3[n]

-1 -0.5 0 0.5 10

10

30

50Spectrum of x

4[n]

Normalized frequency - to

Sp

ectr

al A

mp

litu

de

%four time bases of length 10, 20 and 40 and 100

t1 = 0:9;

t2 = 0:19;

t3 = 0:39;

t4 = 0:99;

%Create frequency base of 1024 points between +/- pi

w = linspace(-pi, pi, 1024);

omega=pi/2; %Common frequency for all four signals

x1=cos(omega*t1); x2=cos(omega*t2);

x3=cos(omega*t3); x4=cos(omega*t4);

%Compute 1024 point FFTs

X1 = fftshift(abs(fft(x1, 1024)));

X2 = fftshift(abs(fft(x2, 1024)));

X3 = fftshift(abs(fft(x3, 1024)));

X4 = fftshift(abs(fft(x4, 1024)));

subplot(411); plot(w/pi, X1); title('Spectrum of x_1[n]'); grid

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

xlabel('Normalized frequency -\pi to \pi') RP

Page 47: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

Frequency Resolution

of the DTFT

Observe the following:

While the peak spectral component is correctly

located at π/2 in each case, the peak is not

sharp there appears to be other frequencies:

• These are also due to using a finite length

signal, which can be interpreted as windowing

with a rectangular function (more on this later)

• Gibbs’ phenomenon

• These are artifacts – these frequencies do not

actually exist in the signal

The width of the main lobe is inversely

proportional to the length of the signal

The amplitude of the peaks are directly

proportional to the length of the signal

The longer the signal, the larger the number

of side lobes but with narrower width for

each.

-1 -0.5 0 0.5 10

2

4

6Spectrum of x

1[n]

-1 -0.5 0 0.5 10

5

10Spectrum of x

2[n]

-1 -0.5 0 0.5 10

10

20Spectrum of x

3[n]

-1 -0.5 0 0.5 10

10

30

50Spectrum of x

4[n]

Normalized frequency - to

Sp

ectr

al A

mp

litu

de

-0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2

0

2

4

Spectrum of x1[n]

-0.7 -0.65 -0.6 -0.55 -0.5 -0.45 -0.4 -0.35 -0.30

2

4

6

8

Spectrum of x2[n]

-0.6 -0.55 -0.5 -0.45 -0.4 -0.350

5

10

15

Spectrum of x3[n]

-0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.40

10

30

Spectrum of x4[n]

Normalized frequency - to

RP

Page 48: Discrete Time Fourier Transform (DTFT) - Kasetsart …jan/dsp/Note/Lecture-08-1-R02.pdf · Chebychev Elliptic. Stability. Filter ... Discrete – Time Fourier Transform (DTFT)

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