dtft of a finite-length portion of the signaldsp/dsp2014/slides/course 06_2.pdf · dtft of a...

Post on 15-Mar-2020

12 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Approximating the SpectrumDTFT of a finite-length portion of the signal

• In sum, when applying DTFT only for the samples in a rectangular window of the signal, the approximation is caused by

(1) frequency domain convolution with a sync function

(2) aliasing

• Although imperfect, this is a feasible way we can do in practice for finding the spectrum of a signal.

Approximating the SpectrumDTFT of a finite-length portion of the signal

• What can be done to further improve the performance?

• The rectangular window is applied in the above.

• It can be replaced by other better windowing functions(eg., Hann, Hamming) that will distort the shape of spectrum less.– will be investigated in the future

Segmenting the signal

• In the above, we only use a single segment of the signal and compute its DTFT.

• It is natural to extend this idea by separating a signal into multiple segments in time, and compute the DTFT for each segment along the time axis.

• The segments can be either non-overlapping or overlapping.

Spectrogram

• In this way, we can obtain a two-dimensional map(like a 2D image) – the horizontal axis is the time interval

– the vertical axis is the frequency in [-/T, /T].

– the gray level is the magnitude of DTFT of the associated segment.

• This is called spectrogram, a common way for viewing the spectral domain response for a signal in practice.– Sometimes the gray level is the magnitude square of DTFT,

depending on how it is defined.

Spectrogram Examples

Synthesized notes, C,D,E,F,G,A,B,CSpectrogram of Fur Elise played on a piano

Spectrogram Examples• DTFT range: [-𝜋, 𝜋]• Associated CFT range:

[-𝜋/𝑇𝑠 , 𝜋/𝑇𝑠] in radians.

• That is, [-𝜔𝑠/2,𝜔𝑠/2] in radians. (because 𝑤𝑠 = 2𝜋/𝑇𝑠)

• This is equivalent to [-𝑓𝑠/2,𝑓𝑠/2] in Hz.

• In the example:• 𝑓𝑠 = 8000 𝐻𝑧• 𝑓𝑠/2 = 4000 = 4 𝑘𝐻𝑧• For real-valued signal,

the magnitude is an even function. Only show the positive side [0,𝑓𝑠/2] in the spectrogram to ease the viewing

Further Improvement

• In the above, we compute the DTFT for a finite-length signal (of length N).

• To record the frequency domain of DTFT, we have to record a continuous function in the range of [-, ].

• However, to record exactly a continuous function in a digital device is difficult in practice.

• Eg, a time-domain N-point (N=11) discrete-time signal

• Its DTFT domain is continuous

Another example of a finite-length x(n) and its DTFT X(ejw).Remark: in this example, we extend [-, ] to a periodic form for visualization

A finite-length signal

Magnitude spectrum of DTFT

Phase spectrum of DTFT

A remark on DTFT viewing

• Though DTFT is typically viewed in [-, ], sometimes we draw all of the periods.

• Besides, because every period contains the same information, in some cases we draw [0, 2] for visualization.

• For real signal, the spectrum is an even function. Both cases [-, ] and [0, 2] can be reduced into [0, ] due to symmetry.

Further Improvement

• There are only N points in time domain for a finite-duration signal (i.e., time domain is an N-dimensional vector).

• We know that time and frequency domains retain the same information for signal representation.

• So, it seems to be redundant if we have to use a continuous function (containing infinite points) in the frequency domain for recording the information.

Further Improvement

• Can we use only a finite number points (eg., Npoints) to record the frequency domain of DTFT for a finite-duration signal?

• This leads us to the development of the fourth type of Fourier transform, Discrete Fourier Transform (DFT).

Discrete Fourier Transform (DFT)

• Consider both the signal and the spectrum only within one period (N-point signals both in time and frequency domains)

where , and Wn are the roots of WN=1.

DFT

IDFT(inverseDFT)

NjeW /2

From Kuhn 2005

DFT in matrix form

DTFT pairs (more specifically)

• Forward transform:

• Inverse transform:

where

• The matrix of DFT is unitary, i.e.,

𝑫𝑵∗ 𝑫𝑵 = 𝑫𝑵𝑫𝑵

∗ = 𝑰𝑵, or 𝑫𝑵−𝟏 = 𝑫𝑵

∗ ,

where 𝑰𝑵 is the 𝑵×𝑵 identity matrix.

• That is, the inner products of two different columns of 𝑫𝑵 are zero (the columns of 𝑫𝑵 are orthogonal to each other)

𝟏

𝑵

n-th Root of 1

• 𝑊𝑁𝑛 is the n-th root of the equation 𝑾𝑁 = 1.

• Eg., when n=8,

Visualization Illustration

• Eg., 8-point DFT

Relation between DFT and DTFT for finite-length signals

• Property: The frequency domain of an N-point DFT are the same as the N-point uniform samples of DTFT in [0, 2].

• Explanation:– If we repeat the length-N signal over time, we can get a

discrete-time signal that is also periodic. – It is easy to recover the original length-N signal from the

resulted periodic signal (by extracting only a single period of it). So, they contain the same ‘information’.

– The DTFT spectrum of a discrete and periodic signal is also discrete and periodic, because the time domain periodicity implies the frequency domain discretization, and vice versa.

– Hence, reconstructing the discrete-time periodic signal can also reconstruct the original length-N signal.

DTFT of a discrete and periodic signal

• The DTFT spectrum of a discrete and periodic signal is also discrete and periodic.

• Note that the DTFT spectrum of the periodic signal is the N-point uniform samples of original continuous DTFT spectrum.

A discrete-time periodic signal

Its magnitude spectrum (sampled)

Its phase spectrum (sampled)

Relation between DFT and DTFT for finite-length signals

• IDFT give us an algorithm to reconstruct the N-length discrete-time signal.

• Question: Can we reconstruct the DTFT spectrum (continuous in w) from the N-length spectrum of DFT?

• Since the N-length signal can be exactly recovered from both the DFT and the DTFT spectra, we expect that the DTFT spectrum (that is continuous in [0, 2]) can be exactly reconstructed by the DFT spectrum (that is discrete).

Reconstruct DTFT from DFT(when the sequence is finite-length)

By substituting the inverse DFT into the x(n), we have

a geometric sequence

Continuous DTFT spectrum

Inverse DFT of N points

By applying the geometric-sequence formula

magnitude

phase

So

The reconstruction formulaFrom X(k), the spectrum of DFT , we can reconstruct the spectrum of DTFT, X(ejw) by the above interpolation.

Hence, instead of computing the DTFT of a finite-duration signal directly, we always use DFT for the computation, and the DTFT spectrum can be exactly reconstructed for any w.

Another way to interpolate X(ejw) from X(k) is zero-padding that will be shown below.

Dirichlet Kernel

Definition of DFT in Boaz Porat’s Book

Remark

• There could be different notations from different articles and books.

• The Fourier transform is referred to as DTFT below.

DTFT

Zero padding

• In the above, we have introduced how to reconstruct the DTFT spectrum of an length-N signal from the DFT spectrum of the same length-N signal.

• Sometimes our purpose is for visualization or efficient maximum finding. The N samples of the DTFT spectrum is too few. We often like to see the M-point uniform samples of the DTFT of the length-N signal (with M>N).

• In practice, we can use a simple technique called zero-padding technique to achieve this purpose, which complement M-N zeros in the end of the original length-N sequence and then performing DFT. Then, the obtained M-point DFT spectrum is just the M-point uniform samples for the DTFT of the length-N signal.

Fast Fourier Transform (FFT)

An important characteristic of DFT is that it can be computed very fast

DFT pairs:

WN = ej2/N is a root of the equation WN=1.

It requires N2 complex multiplications and (N1)N complex additions for direct computation.

1

0

1...,1,0 ,][][N

n

kn

N NkWnxkX

1

0

1...,1,0 ,][1

][N

k

kn

N NnWkXN

nx

Decimation-in-time FFT algorithm

Most conveniently illustrated by considering the special case of N an integer power of 2, i.e, N=2v.

Since N is an even integer, we can consider computing X[k] by separating x[n] into two (N/2)-point sequence consisting of the even numbered point in x[n] and the odd-numbered points in x[n].

dd

][][][on

nk

N

evenn

nk

N WnxWnxkX

Decimation-in-time FFT algorithm

With the substitution of variable n=2r for n even and n=2r+1 for n odd:

By the key property:

We have

1)2/(

0

)12(1)2/(

0

2 ]12[]2[][N

r

kr

N

N

r

rk

N WrxWrxkX

( /2) 1 ( /2) 12 2

0 0

[ ] [2 ]( ) [2 1]( )N N

rk k rk

N N N

r r

X k x r W W x r W

2/

)2//(2)/2(22

N

NjNj

N WeeW

( /2) 1 ( /2) 1

/2 /2

0 0

[2 ]( ) [2 1]( )N N

rk k rk

N N N

r r

x r W W x r W

In sum,

• Both G[k] and H[k] can be computed by (N/2)-point DFT

• G[k]: the (N/2)-point DFT of the even numbered points of the original sequence

• H(k): the (N/2)-point DFT of the odd-numbered point of the original sequence.

• Although the index ranges over N values, k = 0, 1, …, N-1, they must be computed only for k between 0 and (N/2)-1, since G[k] and H[k] are each periodic in k with period N/2.

1,...,1,0 ],[][ NkkHWkG k

N

( /2) 1 ( /2) 1

/2 /2

0 0

[ ] [2 ]( ) [2 1]( )N N

rk k rk

N N N

r r

X k x r W W x r W

Decomposing N-point DFT into two (N/2)-point DFT for the case of N=8

We can further decompose the (N/2)-point DFT into two (N/4)-point DFTs. For example, the upper half of the previous diagram can be decomposed as

Hence, the 8-point DFT can be obtained by the following diagram with four 2-point DFTs.

Flow graph of a 2-point DFT

Finally, each 2-point DFT can be implemented by the following signal-flow graph, where no multiplications are needed.

Flow graph of complete decimation-in-time decomposition of an 8-point DFT.

In each stage of the decimation-in-time FFT algorithm, there are a basic structure called the butterfly computation:

The butterfly computation can be simplified as follows:

Flow graph of a basic butterfly computation in FFT.

Simplified butterfly computation.

][][][

][][][

11

11

qXWpXqX

qXWpXpX

m

r

Nmm

m

r

Nmm

Flow graph of 8-point FFT using the simplified butterfly computation

• In the above, we have introduced the decimation-in-time algorithm of FFT.

• Here, we assume that N is the power of 2. For N=2v, it requires v=log2N stages of computation.

• The number of complex multiplications and additions required was N+N+…N = Nv = N log2N.

• When N is not the power of 2, we can apply the same principle that were applied in the power-of-2 case when N is a composite integer. For example, if N=RQ, it is possible to express an N-point DFT as either the sum of R Q-point DFTs or as the sum of Q R-point DFTs.

• The FFT algorithm of power-of-two is also called the Cooley-Tukey algorithm since it was first proposed by them.

Decimation-in-frequency FFT algorithm

The decimation-in-time FFT algorithms are all based on structuring the DFT computation by forming smaller and smaller subsequences of the input sequence x[n]. Alternatively, we can consider dividing the output sequence X[k] into smaller and smaller subsequences in the same manner.

The even-numbered frequency samples are

So,

1,...,1,0 ][][1

0

NkWnxkXN

n

nk

N

1

)2/(

)2(1)2/(

0

)2(1

0

)2( ][][][]2[N

Nn

rn

N

N

n

rn

N

N

n

rn

N WnxWnxWnxrX

1)2/(

0

))2/((21)2/(

0

2 )]2/([][]2[N

n

Nnr

N

N

n

nr

N WNnxWnxrX

Since

and , we have 𝑊𝑁2𝑛𝑟 = 𝑊𝑁/2

𝑛𝑟 .

Then, both the first half and last half share the same multiplication term, 𝑊𝑁/2

𝑛𝑟 , and so

The above equation is the (N/2)-point DFT of the (N/2)-point sequence obtained by adding the first and the last half of the input sequence.

Analogical meaning: Adding the two halves of the input sequence represents time aliasing, consistent with the fact that in computing only the even-number frequency samples, we are sub-sampling the Fourier transform of x[n].

nr

N

rN

N

nr

N

Nnr

N WWWW 22)]2/([2

2/

2

NN WW

1)2/(,...,1,0 )])2/([][(]2[1)2/(

0

2/

NrWNnxnxrXN

n

nr

N

We now consider obtaining the odd-numbered frequency points:

Since

1

)2/(

)12(1)2/(

0

)12(1

0

)12( ][][][]12[N

Nn

rn

N

N

n

rn

N

N

n

rn

N WnxWnxWnxrX

)12(1)2/(

0

)12(1)2/(

0

2/

)12(1)2/(

0

2/

)12(1)2/(

0

)12)(2/(

1)2/(

0

)12)(2/(1

2/

)12(

)]2/([

)]2/([

)]2/([

)]2/([

)]2/([][

rn

N

N

n

rn

N

N

n

N

N

rn

N

N

n

NNr

N

rn

N

N

n

rN

N

N

n

rNn

N

N

Nn

rn

N

WNnx

WNnxW

WNnxW

WNnxW

WNnxWnx

We obtain

The above equation is the (N/2)-point DFT of the sequence obtained by subtracting the second half of the input sequence from the first half and multiplying the resulting sequence by WN

n.

Let g[n] = x[n]+x[n+N/2] and h[n] = x[n]x[x+N/2], the DFT can be computed by forming the sequences g[n] and h[n], then computing h[n]WN

n, and finally computing the (N/2)-point DFTs of these two sequences.

1)2/(,...,1,0 ])2/[][(

])2/[][(]12[

2/

1)2/(

0

1)2/(

0

)12(

NrWWNnxnx

WNnxnxrX

nr

N

N

n

n

N

N

n

rn

N

Flow graph of decimation-in-frequency decomposition of an N-point DFT (N=8).

Recursively, we can further decompose the (N/2)-point DFT into smaller substructures:

Finally, we have

Butterfly structure for decimation-in-frequency FFT algorithm:

The decimation-in-frequency FFT algorithm also has the computation complexity of O(N log2N)

top related