36
Discrete Fourier Transform

Discrete Fourier Transform - IMT

  • Upload
    others

  • View
    30

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Discrete Fourier Transform - IMT

Discrete Fourier Transform

Page 2: Discrete Fourier Transform - IMT

Discrete Fourier Transform (DFT)

The DFT of a finite signal (FS) defined on {0, … , 𝑁 βˆ’ 1} is another FS defined on the same support {0, … , 𝑁 βˆ’ 1}:

βˆ€π‘˜ ∈ 0,1, … , 𝑁 βˆ’ 1 , 𝑒 π‘˜= π‘’π‘›π‘’βˆ’2π‘–πœ‹

π‘˜π‘π‘›

π‘βˆ’1

𝑛=0

The index of 𝑒 is π‘˜, but the corresponding wave frequency is π‘˜/𝑁

Page 3: Discrete Fourier Transform - IMT

Inversion theorem

The inversion formula is:

𝑒𝑛 =1

𝑁 𝑒 π‘˜π‘’

2π‘–πœ‹π‘˜π‘π‘›

π‘βˆ’1

π‘˜=0

proof :

1

𝑁 𝑒 π‘˜π‘’

2π‘–πœ‹π‘˜π‘π‘›

π‘βˆ’1

π‘˜=0

=1

𝑁 π‘’π‘šπ‘’

βˆ’2π‘–πœ‹π‘˜π‘π‘š

π‘βˆ’1

π‘š=0

𝑒2π‘–πœ‹π‘˜π‘π‘›

π‘βˆ’1

π‘˜=0

=1

𝑁 π‘’π‘š π‘§π‘˜

π‘βˆ’1

π‘˜=0

π‘βˆ’1

π‘š=0

with 𝑧 = 𝑒2π‘–πœ‹π‘›βˆ’π‘š

𝑁

Page 4: Discrete Fourier Transform - IMT

Inversion theorem

Given that 𝑧 = 𝑒2π‘–πœ‹π‘›βˆ’π‘š

𝑁 , we find easily :

π‘§π‘˜π‘βˆ’1

π‘˜=0

= π‘π›Ώπ‘›βˆ’π‘š βˆ€π‘›,π‘š, ∈ {0,1, … , 𝑁 βˆ’ 1}

By replacing in the previous equation we find :

1

𝑁 𝑒 π‘˜π‘’

2π‘–πœ‹π‘˜π‘π‘›

π‘βˆ’1

π‘˜=0

=1

𝑁 (π‘’π‘šπ‘π›Ώπ‘›βˆ’π‘š )

π‘βˆ’1

π‘š=0

= 𝑒𝑛

In other terms, 𝑒 (π‘˜)

𝑁 are the coefficients of a decomposition on a Fourier

basis

Page 5: Discrete Fourier Transform - IMT

Classical properties

𝑒 = π›Ώπ‘š β‡’ 𝑒 π‘˜ = π‘’βˆ’2𝑖 πœ‹

π‘šπ‘π‘˜

β„± π‘’βŠ›π‘ 𝑣 = 𝑒 𝑣

β„± 𝑒𝑣 =1

𝑁𝑒 βŠ›π‘ 𝑣

β„± πœ™π‘’ = 𝑒 π‘˜ βˆ’ π‘˜0 πœ™π‘› = 𝑒2𝑖 πœ‹π‘˜0𝑁𝑛

β„± π‘’π‘š = 𝑒 π‘˜π‘’βˆ’2𝑖 πœ‹

π‘šπ‘π‘›

Symmetry properties

Circular convolution

Circular permutation

Page 6: Discrete Fourier Transform - IMT

Parseval β€œequality”

β€’ Fourier waves are orthogonal with norm 𝑁

β€’ We deduce:

𝑒 2 = 𝑒 π‘˜2

π‘βˆ’1

π‘˜=0

= π‘’π‘›π‘’βˆ’2π‘–πœ‹

π‘˜π‘π‘›

π‘βˆ’1

𝑛=0

π‘βˆ’1

π‘˜=0

𝑒 π‘šπ‘’2π‘–πœ‹π‘˜π‘π‘š

π‘βˆ’1

π‘š=0

= 𝑒𝑛𝑒 π‘š

π‘βˆ’1

π‘š=0

π‘βˆ’1

𝑛=0

π‘’βˆ’2π‘–πœ‹π‘˜π‘(π‘›βˆ’π‘š)

π‘βˆ’1

π‘˜=0

= 𝑁 𝑒 2

Page 7: Discrete Fourier Transform - IMT

Links between DT and DTFT

β€’ DFT is the only transform that can be computed on a computer …

β€’ DFT can approximate DTFT under certain hypotheses

Page 8: Discrete Fourier Transform - IMT

Case of a finite support sequences

β€’ Consider 𝑒 defined on β„€, with finite support:

𝑒𝑛 = 0 βˆ€π‘› βˆ‰ {0,… ,𝑁 βˆ’ 1}.

β€’ Let 𝑣 be the restriction of 𝑒 to {0,… ,𝑀 βˆ’ 1}, with 𝑀 β‰₯ 𝑁,

𝑣 π‘˜ = π‘£π‘›π‘’βˆ’2π‘–πœ‹

π‘˜π‘€π‘›

π‘€βˆ’1

𝑛=0

= 𝑒 π‘˜

𝑀

β€’ Sometimes 𝑣 is called M-DFT of 𝑒 (zero-padding)

β€’ We talk about 𝑀-DFT of a finite support sequence

Page 9: Discrete Fourier Transform - IMT

Case of a finite support series

β€’ By changing 𝑀, one can sample 𝑒 𝜈 as finely as necessary

β€’ This is equivalent to a zero-padding

β€’ However, one needs only 𝑁 samples of 𝑒 𝜈 to perfectly know (reconstruct) 𝑒

𝑒 π‘˜

π‘π‘˜βˆˆ{0,…,π‘βˆ’1}

DFTβˆ’I 𝑒DTFT

𝑒 (𝜈)

β€’ How to generalize ? When is it possible with

samples at 1

𝑁 to reconstruct a function of real

variable?

Page 10: Discrete Fourier Transform - IMT

Signal on Z (left) and its DTFT (right) Support {0, …, 59}

Example

Page 11: Discrete Fourier Transform - IMT

Right: 60-DFT (indexed by k) of the non null part of the signal on left.

Example

Page 12: Discrete Fourier Transform - IMT

Indexed by π‘˜/𝑀 and periodized by period 1

to remain in the interval βˆ’1

2,1

2

Example

Page 13: Discrete Fourier Transform - IMT

Superposition of DFT and DTFT. As 𝑀 β‰₯ 𝑁 the DFT is a perfect sampling of the DFTF

Page 14: Discrete Fourier Transform - IMT

Wave frequency determination

β€’ We observe 𝑁 samples of a wave signal.

β€’ From these samples, we want to find the wave frequency

Page 15: Discrete Fourier Transform - IMT

Wave frequency calculation

βˆ€π‘› ∈ β„€, 𝑒𝑛 = 𝑒2π‘–πœ‹πœˆ0𝑛 i.e., 𝑒 = πœ™, FW at frequency 𝜈0

We can only observe a finite number of samples; we have 𝑒𝑇 = πœ™π‘€

where 𝑀 is a finite support sequence:

𝑀𝑛 = 1 if 𝑛 ∈ {0,…𝑁 βˆ’ 1}0 otherwise

Rectangular window

Page 16: Discrete Fourier Transform - IMT

Wave frequency calculation

β€’ The DTFT of 𝑒𝑇: β„±(𝑒𝑇) = β„± πœ™π‘€

= 𝑀 𝜈 βˆ’ 𝜈0

We find:

𝑀 𝜈 =sin πœ‹π‘πœˆ

sin πœ‹πœˆ

Then, 𝜈0 is the position

of the maximum of β„±(𝑒𝑇) -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.50

2

4

6

8

10

12

14

16

18

20

𝑀 𝜈 for N=20

Page 17: Discrete Fourier Transform - IMT

DTFT of a wave of frequency 0,123 trunkated at 20 samples

Page 18: Discrete Fourier Transform - IMT

Wave frequency calculation

β€’ Problem : we cannot compute 𝑒𝑇 𝜈 , but only its samples at 1/𝑀

β€’ The position of the maximum will therefore be known with a precision related to the order 𝑀 of the DFT and rather than to the duration of the observation, 𝑁

Page 19: Discrete Fourier Transform - IMT

β€’ 30-DFT (left) and 60-DFT (right) β€’ The precision for the frequency computation is 1/𝑀 β€’ We select the index k for which the DFT is maximum

Page 20: Discrete Fourier Transform - IMT

Separation of two frequencies (waves)

β€’ The duration of observation affects the frequency resolution

β€’ We consider a mixture of two Fourier waves, observed over 𝑁 samples:

𝑒𝑛 = 𝐴0𝑒2π‘–πœ‹πœˆ0𝑛 + 𝐴1𝑒

2π‘–πœ‹πœˆ1𝑛

Page 21: Discrete Fourier Transform - IMT

𝑁 = 20. Left : the 2 DTFT; right: their sum. We cannot distinguish two close

frequency waves (at less than 1/𝑁)

Frequency resolution

Page 22: Discrete Fourier Transform - IMT

𝑁 = 60 We can now distinguish the two frequencies

Frequency resolution

Page 23: Discrete Fourier Transform - IMT

β€’ The DFT of the 2 waves mixture is :

𝐴0π‘€π‘˜

π‘€βˆ’ 𝜈0 + 𝐴1𝑀

π‘˜

π‘€βˆ’ 𝜈1

β€’ If 𝐴0 = 𝐴1, the two peaks can be separated if their lobes are separated by a half-amplitude

β€’ The amplitude of the lobe depends on the window:

for the stair window it is 1

𝑁

β€’ The condition is, in this case: 𝑁 β‰₯1

|𝜈0βˆ’πœˆ1|

Frequency resolution

Page 24: Discrete Fourier Transform - IMT

Very different amplitudes, masking and windowing problems

β€’ In order to improve frequency resolution, one has to increase the number of observed samples 𝑁, if possible.

β€’ This does not depend on the order 𝑀 of the DFT

– We still need to insure 𝑀 β‰₯ 𝑁

β€’ What happens if the two waves have very different amplitudes?

Page 25: Discrete Fourier Transform - IMT

Left: DTFT of two waves. Right: DTFT of their sum.

Secondary peaks mask the second wave.

Page 26: Discrete Fourier Transform - IMT

Choice of the window shape

Top: Hamming window. Bottom: stair (or rectangular) window

Size 30 in both cases

Page 27: Discrete Fourier Transform - IMT

Left : DTFT of a stair window of size 30. Right : DTFT of a Hamming window.

Choice of the window shape

Page 28: Discrete Fourier Transform - IMT

Multiplication by the Rectangular window

Multiplication by the Hamming window

Page 29: Discrete Fourier Transform - IMT

Frequency analysis: conclusion

β€’ Calculation of the frequency for a Fourier wave: precision = 1/𝑀

β€’ Separation of 2 waves with the same amplitude : Ξ”πœˆ β‰₯ 1/𝑁

β€’ Separation of 2 waves with very different amplitudes : depends on the ratio between the amplitude of the principal and secondary lobes

– This does not depend on 𝑁 , but on the shape of the window

Page 30: Discrete Fourier Transform - IMT

The spectrogram

β€’ The idea of the spectrogram is to locally analyze the frequency content of a signal.

β€’ Around each signal sample, we keep a window on which we compute a DTFT (through a DFT)

β€’ For a signal u and a window w centered in zero:

βˆ€π‘› ∈ β„€, βˆ€πœˆ ∈ βˆ’1

2,1

2, π‘ˆ 𝑛, 𝜈 = π‘’π‘šπ‘€π‘šβˆ’π‘›π‘’

βˆ’2π‘–πœ‹πœˆπ‘š

π‘šβˆˆβ„€

We can compute directly the samples of π‘ˆ 𝑛, 𝜈 through βˆ€π‘› ∈ β„€, βˆ€π‘˜ ∈ {0,…𝑀 βˆ’ 1},

π‘ˆ 𝑛,π‘˜

𝑀= π‘’π‘šπ‘€π‘šβˆ’π‘›π‘’

βˆ’2π‘–πœ‹π‘˜π‘€π‘š

π‘šβˆˆβ„€

Page 31: Discrete Fourier Transform - IMT

The spectrogram

β€’ For 𝑛 (time index) fixed, we have the formula

βˆ€πœˆ ∈ βˆ’1

2,1

2, π‘ˆ 𝑛, 𝜈 = π‘’π‘šπ‘€π‘šβˆ’π‘›π‘’

βˆ’2π‘–πœ‹πœˆπ‘š

π‘šβˆˆβ„€

β€’ This means that π‘ˆ(𝑛, 𝜈) is the DTFT of 𝑒 multiplied by the window𝑀 translated by 𝑛 : frequency analysis around the time instant 𝑛

Page 32: Discrete Fourier Transform - IMT

The spectrogram

β€’ For a fixed frequency, we have the formula:

π‘ˆ 𝑛, 𝜈0 = π‘’π‘šπ‘€π‘šβˆ’π‘›π‘’βˆ’2π‘–πœ‹πœˆ0(π‘›βˆ’π‘š)π‘’βˆ’2π‘–πœ‹πœˆ0𝑛

π‘š

π‘ˆ 𝑛, 𝜈0 = π‘’π‘šπ‘€π‘šβˆ’π‘›π‘’βˆ’2π‘–πœ‹πœˆ0 π‘›βˆ’π‘š

π‘š

= < 𝑒,πœ“π‘› >

πœ“ = π‘€πœ™πœˆ0

Scalar product between 𝑒 and πœ“π‘›: similitude between 𝑒 and a Β« wave Β» truncated around 𝑛 and with frequency 𝜈0

Page 33: Discrete Fourier Transform - IMT

Spectrogram display

β€’ Since we have real signals, the module of the DTFT is symmetrical.

β€’ Time axis is π‘₯ and frequency axis is 𝑦 (in Hz)

β€’ We use a logarithmic scale for the module, otherwise certain frequencies will Β« smash Β» the others (ear sensitivity is btw logarithmic)

Page 34: Discrete Fourier Transform - IMT

Example

Left: DTFT; right: spectrogram of the same signal. The DTFT does not allow to know at which time instant arrives the wave at 15000Hz.

Page 35: Discrete Fourier Transform - IMT

Observation of a sound on the spectrogram

Piano: Original

Page 36: Discrete Fourier Transform - IMT

Spectrogram of the mp3-encoded version

MP3: 128kbits/s