0% found this document useful (0 votes)
39 views37 pages

Aidp 03 DFT

Uploaded by

Adika Stadevant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views37 pages

Aidp 03 DFT

Uploaded by

Adika Stadevant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Discrete Fourier Transform - DFT

and
Fast Fourier Transform – FFT

x(n) y(n)
system
X(k) Y(k)
Time-continuous LTI signals and systems - review


𝑿(𝒔) = න 𝒙 𝒕 ∙ 𝒆−𝒔𝒕 𝒅𝒕 LT
−∞


𝑿(𝒋𝝎) = න 𝒙 𝒕 ∙ 𝒆−𝒋𝝎𝒕 𝒅𝒕 FT
−∞

𝑇
2
𝒄𝒌 = 𝑿(𝒌) = 𝐶 න 𝒙 𝒕 ∙ 𝒆−𝒋𝒌.𝝎𝟎 𝒕 𝒅𝒕 FR
𝑇

2

Periodic signals!
T=1/f0
Discrete Fourier Transform - DFT

• for analysis of the aperiodic time-continuous signals: Fourier transform


𝑿(𝝎) = න 𝒙 𝒕 ∙ 𝒆−𝒋𝝎𝒕 𝒅𝒕
0

• for analysis of the periodic time-continuous signals: Fourier series

1
𝒄𝒌 = 𝑿(𝒌) = න 𝒙 𝒕 ∙ 𝒆−𝒋𝒌𝝎𝒕𝒅𝒕
𝑇 𝑇
-------------------------------------------------------------------------------------------------------------

• for analysis of the periodic discrete signals x(n)???


𝑿 𝒌 =?

2𝜋
𝜔= = 2𝜋 ∙ 𝑓
𝑇
Discrete Fourier Transform - DFT
Consider a periodic sequence 𝑥(𝑛)
෤ with period N:
𝑥෤ 𝑛 = 𝑥෤ 𝑛 + 𝑎. 𝑁 , 𝑎 − 𝑖𝑛𝑡𝑒𝑔𝑒𝑟

• 𝑥෤ 𝑛 in terms of FS - as a sum of sine and cosine sequences, i.e. complex


2𝜋
exponentials with frequences 𝑘 ∙ - integer multiples of the fundamental
𝑁
frequency associated with periodic sequence
• difference between FS for continuous and discrete function: for discrete
sequence – there are only N distinct complex exp. having a period that is an
integer submultiple of N!
𝟐𝝅
−𝒋 𝒌𝒏
𝒆𝒌 (𝒏) = 𝒆 𝑵
Discrete Fourier Transform - DFT
then 𝒆𝑶 (𝒏) = 𝒆𝑵 (𝒏)
𝒆𝟏 (𝒏) = 𝒆𝑵+𝟏 (𝒏)
𝒆𝟐 (𝒏) = 𝒆𝑵+𝟐 (𝒏)
....

it means – FS of periodic sequence 𝑥(𝑛)


෤ has only N distinct exp.functions:

𝑁−1 1
1 𝟐𝝅 - only convetion
෩ 𝒌 ∙ 𝒆 𝑵 ∙𝒌∙𝒏
෥(𝒏) = ෍ 𝑿
𝒙 𝒋∙
𝑁
𝑁
𝑘=0

෩ 𝒌 from 𝒙
How to solve 𝑿 ෥(𝒏) ??
Discrete Fourier Transform - DFT
𝑁−1
1 𝟐𝝅
𝒋∙ ∙𝒓∙𝒏 1 for 𝑟 = 𝑚. 𝑁
෍𝒆 𝑵 =
𝑁 0 otherwise
𝑛=0

𝑁−1
1 𝟐𝝅
෩ 𝒌 ∙ 𝒆 𝑵 ∙𝒌∙𝒏
෥(𝒏) = ෍ 𝑿
𝒙 𝒋∙
𝑁
𝑘=0

𝑁−1 𝑁 −1 𝑁−1
𝟐𝝅
−𝒋∙ ∙𝒓∙𝒏 1 𝟐𝝅
෥(𝒏) ∙
෍𝒙 𝒆 𝑵 ෩ 𝒌 ∙ 𝒆 𝑵 ∙(𝒌−𝒓)∙𝒏
= ෍ ෍𝑿 𝒋∙
𝑁
𝑛=0 𝑛=0 𝑘=0

𝑁−1 𝑁−1 𝑁−1


𝟐𝝅
−𝒋∙ ∙𝒓∙𝒏 1 𝟐𝝅
෥(𝒏) ∙
෍𝒙 𝒆 𝑵 ෩ 𝒌 ∙ ෍ 𝒆 𝑵 ∙(𝒌−𝒓)∙𝒏 = 𝑿
= ෍𝑿 𝒋∙ ෩ 𝒓
𝑁
𝑛=0 𝑘=0 𝑛=0

𝑁−1
𝟐𝝅
෩ 𝒌 = ෍𝒙 −𝒋∙ ∙𝒌∙𝒏
𝑿 ෥(𝒏) ∙ 𝒆 𝑵
𝑛=0
DFT - for discrete periodic signals
- analogy to Fourier series

For discrete periodic signal x(n) with period N


DFT: ∞
𝑿(𝒋𝝎) = න 𝒙 𝒕 ∙ 𝒆−𝒋𝝎𝒕 𝒅𝒕 𝑁−1 𝟐𝝅
0 1 𝟐𝝅
−𝒋 𝒌𝒏 ∙ 𝒌 = 𝛀𝟎 ∙ 𝒌
𝑿(𝒌) = ෍ 𝒙 𝒏 ∙ 𝒆 𝑵 𝑵
𝑁
𝑛=0
X(k) is Fourier image of x(n) in frequency domain, simply spectrum of the signal x(n)
For discrete periodic spectrum X(k) with period N
IDFT:
𝑁−1
𝟐𝝅
𝒋 𝒌𝒏
𝒙(𝒏) = ෍ 𝑿 𝒌 ∙ 𝒆 𝑵
𝒋
𝟐𝝅
𝑾=𝒆 𝑵
𝑘=0

DFT: IDFT:
𝑁−1
𝑁−1
1 𝒙(𝒏) = ෍ 𝑿 𝒌 ∙ 𝑾+𝒌𝒏
𝑿(𝒌) = ෍ 𝒙 𝒏 ∙ 𝑾−𝒌𝒏
𝑁 𝑘=0
𝑛=0
Properties of DFT
Periodicity of DFT a IDFT

𝑥 𝑛 =𝑥 𝑛+𝑁 , 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 = 0,1,2, … 𝑁 − 1


𝑋 𝑘 =𝑋 𝑘+𝑁 , 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑘 = 0,1,2, … 𝑁 − 1

Linearity of DFT a IDFT


For periodic sequences 𝑥1 𝑛 and 𝑥2 𝑛 with period N :

𝐷𝐹𝑇 𝑥1 𝑛 = 𝑋1 𝑘
𝐷𝐹𝑇 𝑥2 𝑛 = 𝑋2 𝑘 ,

then

𝐷𝐹𝑇 𝑎1 . 𝑥1 𝑛 + 𝑎2 . 𝑥2 𝑛 = 𝑎1 𝑋1 𝑘 +𝑎2. 𝑋2 𝑘
Properties of DFT and IDFT
Time-shift
For periodic sequence x 𝑛 with period N and their spectrum X 𝑘 :
2𝜋
−𝑗 𝑛 𝑘
𝐷𝐹𝑇 𝑥 𝑛 − 𝑛0 =𝑋 𝑘 ∙𝑒 𝑁 0

2𝜋
+𝑗 𝑛 𝑘
𝐷𝐹𝑇 𝑥 𝑛 + 𝑛0 =𝑋 𝑘 ∙𝑒 𝑁 0

𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 < 𝑁

Spectral domain shift


For spectral function X 𝑘 of periodic sequence x 𝑛 with period N is the
shifted X(k+- 𝑘0 ) :
2𝜋
+𝑗 𝑛𝑘0
𝐼𝐷𝐹𝑇 𝑋 𝑘 − 𝑘0 =𝑥 𝑛 ∙𝑒 𝑁

2𝜋
−𝑗 𝑛𝑘0
𝐷𝐹𝑇 𝑋 𝑘 + 𝑘0 =𝑋 𝑘 ∙𝑒 𝑁

𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 < 𝑁


2𝜋
𝑥 𝑛 = cos ∙ 𝑛 ; 𝑁 = 16
16

Matlab nevie indexovať od nuly!!!


2𝜋 𝜋
𝑥 𝑛 = cos ∙𝑛+ ; 𝑁 = 16
16 4

Matlab nevie indexovať od nuly!!!


2𝜋
𝑥 𝑛 = 1 + cos ∙𝑛
16
x3(n) = ifft(X3(k) ) X3(k) = fft(x3(n))
2 20

1.8 15

|X3 |
(k)
1.6 10

1.4 5

1.2
0
0 5 10 15 20
(n)

1
x3

0.8 4

0.6 2

arg(X3 )
(k)
0.4 0

0.2 -2

0 -4
0 5 10 15 0 5 10 15 20
n k
FFT – Fast Fourier Transform
(1965 Cooley and Tukey)

Principle of fast algorithm

• the length of input sequence = N = 2r

• sequential division to the even and odd parts till the length N=1
– trivial case - spectrum of such signal equals to itself

• we ignore constant 1/N


FFT – rýchla Fourierova transformácia
(1965 Cooley a Tukey)

We divide signal x(n) of the length N into 2 sequences


N/2 -to even and odd elements:
x(n) = x(2m) + x(2m+1) = s(m) + y(m)
where s(m) = x(2m)
y(m) = x(2m+1)
n = 0,1,N – 1
m = 0,1,(N/2) – 1

• these two sequences of N/2 elements will be next divided in the


same way – even/odd  we get N/4 elements
• we repeat divisions till N=1
• for sequence with 1 element - N= 1 holds:

x(n) ⎯DFT
⎯⎯→ X (k ) = x(n)
visualisation of FFT divisions

Ako vidno z binárnych reprezentácií koeficientov vstupnej postupnosti a


výstupnej preusporiadanej postupnosti možno kroky postupného delenia
vždy na párnu a nepárnu časť nahradiť jednoduchou reverziou bitov, t.j.
preusporiadanú postupnosť získame podľa vzťahu xp(n) = x(<n>), pričom
<n> predstavuje reverziu bitov v binárnom vyjadrení n.
Pre výpočet inverznej Fourierovaj transformácie použijeme ten istý algoritmus ako pre
doprednú DFT s tým rozdielom že na vstup algoritmu privedieme preusporiadané spektrum
a síce:
X(k) = {X(0), X(N-1), X(N-2),,X(2), X(1)}.
Pre výpočet DFT pomocou FFT je potrebné, aby dĺžka vstupných postupností bola N = 2m
Máme spojitý signál:

Signál navzorkujeme: N=8, ωvz= 8 ω0, resp. Tvz= T0/8


𝑁−1
𝟐𝝅
෥(𝒏) ∙ 𝒆−𝒋∙ 𝑵 ∙𝒌∙𝒏
෩ 𝒌 = ෍𝒙
𝑿
𝑛=0
DFT and IDFT applications

• spectral analysis of natural signals (biomedicine,


seismology, audio, image, ...) – enable to identify spectral
elements

• spectral analysis of aperiodic signals of finite length N


- DFT – N equals to 1 period
example of frequency analysis of the aperiodical discrete signal x(n)
Applications of DFT and IDFT

• periodical signal generation - IDFT can be applied for


signal generating with known spectrum

• N equals to 1 period or its multiple


Applications of DFT and IDFT
Circular convolution of two periodic signals with perion N

• In the output of DFT – information about 1 period spectrum


• In the output of IDFT 1 period of generated of signal
• For aperiodical convolution –the lenght of signal N must be minimum
„linear convolution“, i.e. N=Dx+Dh-1
DFT -summary

• frequency analysis of discrete periodic signals


• DFT – for discrete periodic signals
- analogy to Fourier series for time-continuous periodic
signals
• spectrum X(k) of periodic signal x(n) is discrete and
periodic
• time shift and frequency-domain shift!
• for spectral (frequency) analysis of periodic signal –
lehght N, for DFT – at least 1 period
• FFT – fast algorithm for N= 2k
• convolution vs multiplication!
Filtering in the Frequency Domain–
convolution – to – multiplication

𝑵−1 𝑴−1
1
𝑭 𝒖, 𝒗 = ෍ ෍ 𝒇 𝒙, 𝒚 . 𝒆−𝒋2𝝅(𝒙𝒖Τ𝑵+𝒚𝒗Τ𝑴)
𝑵. 𝑴
𝒙=0 𝒚=0
Low-pass Filtering
HP Filtering
DP Filtering
HP Filtering
Filtering in the Frequency Domain
Filtered Filtered
Picture Fourier Filter Fourier Picture

Low-Pass Filtering

High-Pass Filtering

Band-Pass Filtering
potlačenie rozmazania obrazu

zahmlenie obrazu spôsobené pohybom pri


expozícii snímky
zahmlenie obrazu spôsobené pohybom pri
expozícii snímky
1 T /2
g ( x, y ) =  f (x − x 0 (t ), y − y 0 (t ))dt
T t =−T / 2
kde 𝑥0 (𝑡) a 𝑦0 (𝑡) reprezentujú horizontálny a vertikálny posun obrazu v čase
a T je doba trvania expozície
 
(
G x,y = )   g ( x , y )e − j x x
e
− j y y
dxdy
x = − y = −
  1 T /2 
=   T  f (x − x 0 (t ), y − y 0 (t ))dt  e − j x x − j y y
e dxdy
x = − y = − 
 t = −T / 2 

zjednodušením
( ) (
G x , y = F x , y B x , y )( )
kde
(
B x ,  y ) =
1 T / 2 − j x x0 (t ) − j y y0 (t )
 e
T t = −T / 2
e dt
DFT

( ) (
G x , y = F x , y B x , y)( )
g (n1 , n2 ) = f (n1 , n2 )  b(n1 , n2 )
B(1 ,  2 ) je funkcia rozmazania – DFT b(n1 , n 2 )
Display Fourier Spectrum as
Picture
1. Compute log( F (u ) + 1)
2. Scale to full range
3. Move (0,0) to center of image (Shift by N/2

Example for range 0..10:


Original f 0 1 2 4 100
Scaled to 10 0 0 0 0 10

Log (1+f) 0 0.69 1.01 1.61 4.62


Scaled to 10 0 1 2 4 10
Fourier Displays

F (u )

log( F (u ) + 1)

You might also like