Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Digital Signal Processing
Chapter 5: The Analysis of Signals and Systems in Frequency Domain
Vinh Pham-Xuan
Ho Chi Minh city University of Technology
Department of Telecommunications
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
- If not overlapping:
𝑇 𝑋 𝑓 = 𝑋 𝑓 where −𝑓𝑠
2≤ 𝑓 ≤
𝑓𝑠
2.
- If overlapping:
𝑇 𝑋 𝑓 = 𝑋 𝑓 + 𝑋 𝑓 + 𝑓𝑠 + 𝑋 𝑓 − 𝑓𝑠 + ⋯ where −𝑓𝑠
2≤ 𝑓 ≤
𝑓𝑠
2.
In terms of the time samples 𝑥 𝑛𝑇 , the original sampled spectrum 𝑋 𝑓are given by:
𝑋 𝑓 =
𝒏=−∞
∞
𝑥 𝑛𝑇 𝑒−2𝜋𝑗𝑓𝑛𝑇
2
sampler and quantizer
analog lowpass filter
𝑥𝑖𝑛 𝑡analog signal
𝑥 𝑡bandlimited
signal
𝑥 𝑛𝑇sampled
signal
𝑋 𝑓 𝑋 𝑓
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
However, in practice only a finite number of samples are retained, say𝑥 𝑛𝑇 , 0 ≤ 𝑛 ≤ 𝐿 − 1.
The duration of the data record to be:𝑇𝐿 = 𝐿𝑇
What is the difference between the frequency spectrum of the infinitesignal and the truncated signal?
3
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
The spectrum of time-windowed signal 𝑋𝐿 𝑓 are given by:
𝑋𝐿 𝑓 =
𝑛=0
𝐿
𝑥 𝑛𝑇 𝑒−2𝜋𝑗𝑓𝑛𝑇
𝑋 𝑓 =
𝑛=−∞
∞
𝑥 𝑛𝑇 𝑒−2𝜋𝑗𝑓𝑛𝑇
𝑋𝐿 𝑓 =
𝑛=0
𝐿
𝑥 𝑛𝑇 𝑒−2𝜋𝑗𝑓𝑛𝑇
𝑋𝐿 𝑓 is an approximation of 𝑋 𝑓 . The accuracy increases with thenumber of samples retained.
4
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
We can express 𝑋𝐿 𝑓 as follows:
𝑋𝐿 𝑓 =
𝑛=−∞
∞
𝑥𝐿 𝑛 𝑒−2𝜋𝑗𝑓𝑛𝑇
where𝑥𝐿 𝑛 = 𝑥 𝑛 𝑤 𝑛
where
𝑤 𝑛 = 1, if 0 ≤ 𝑛 ≤ 𝐿 − 10, otherwise
Therefore, the discrete-time Fourier transform of the windowed signal is:
𝑋𝐿 𝜔 =
𝑛=−∞
∞
𝑥𝐿 𝑛 𝑒−𝑗𝜔𝑛
5
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
Using the property that the Fourier transform of the product of two timefunctions is the convolution of their Fourier transforms, we obtain thefrequency-domain version of 𝑥𝐿 𝑛 = 𝑥 𝑛 𝑤 𝑛 .
𝑋𝐿 𝜔 =
−𝜋
𝜋
𝑋 𝜔′ 𝑊 𝜔 − 𝜔′ 𝑑𝜔2𝜋
where 𝑊 𝜔 is the DTFT of the rectangular window 𝑤 𝑛 , that is
𝑊 𝜔 =
𝑛=0
𝐿−1
𝑤 𝑛 𝑒−𝑗𝜔𝑛
6
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
It can be thought of as the evaluation of the z-transform on the unit circleat 𝑧 = 𝑒𝑗𝜔. Setting 𝑤 𝑛 = 1 in the sum, we find:
𝑊 𝑧 =
𝑛=0
𝐿−1
𝑤 𝑛 𝑧−𝑛 =1 − 𝑧−𝐿
1 − 𝑧−1
Setting 𝑧 = 𝑒𝑗𝜔, we find for 𝑊 𝜔 :
𝑊 𝜔 =1 − 𝑒−𝑗𝐿𝜔
1 − 𝑒−𝑗𝜔=
sin 𝜔𝐿/2
sin 𝜔/2𝑒−𝑗𝜔 𝐿−1 /2
7
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
The magnitude spectrum 𝑊 𝜔 is
It consists of a mainlobe of height 𝐿 and base width 4𝜋/𝐿 centered at 𝜔 =0, and several smaller sidelobes.
8
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
Consider the case of a single analog complex sinusoid of frequency 𝑓1 andits sample version:
𝑥 𝑡 = 𝑒2𝜋𝑗𝑓1𝑡, −∞ ≤ 𝑡 ≤ ∞
𝑥 𝑛 = 𝑒2𝜋𝑗𝑓1𝑛𝑇 = 𝑒𝑗𝜔1𝑛, −∞ ≤ 𝑛 ≤ ∞
𝑥𝐿 𝑛 = 𝑒2𝜋𝑗𝑓1𝑛𝑇 = 𝑒𝑗𝜔1𝑛, 0 ≤ 𝑛 ≤ 𝐿 − 1
Fourier transform of the cosine (continuous function):𝑥 𝑡 = 𝑒2𝜋𝑗𝑓1𝑡 → 𝛿 𝑓 − 𝑓1
Assuming that 𝑓1 lies within the Nyquist interval:
𝑋 𝜔 = 𝑋 𝑓 =1
𝑇𝑋 𝑓 =
1
𝑇𝛿 𝑓 − 𝑓1
We can express the spectrum in terms of the digital frequency as follows:
𝑋 𝜔 = 2𝜋𝛿 𝜔 − 𝜔1 =1
𝑇2𝜋𝑇𝛿 2𝜋𝑇𝑓 − 2𝜋𝑇𝑓1 =
1
𝑇𝛿 𝑓 − 𝑓1
9
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
The spectrum of the truncated signal:
𝑋𝐿 𝜔 =
−𝜋
𝜋
𝑋 𝜔′ 𝑊 𝜔 − 𝜔′𝑑𝜔
2𝜋=
−𝜋
𝜋
2𝜋𝛿 𝜔 − 𝜔1 𝑊 𝜔 − 𝜔′𝑑𝜔
2𝜋
𝑋𝐿 𝜔 = 𝑊 𝜔 − 𝜔1
10
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
When 𝑥 𝑡 is a linear combination of two complex sinusoids, withfrequency 𝑓1 and 𝑓2 and amplitudes 𝐴1 and 𝐴2
11
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
Two sharp spectral lines are replaced by their smeared versions.
The frequency separation ∆𝑓 = 𝑓1 − 𝑓2 of the two sinusoids to be largeenough so the main lobes are distinct and do not overlap.
12
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
However, if ∆𝑓 is decreased, the main lobes will begin merging with eachother and will not appear as distinct. This will start to happen when ∆𝑓 isapproximately equal to the mainlobe width ∆𝑓𝑤
13
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
The resolvability condition that the two sinusoids appear as two distinctones is that their frequency separation ∆𝑓 be greater than the mainlobewidth: ∆𝑓 ≥ ∆𝑓𝑤 = 𝑓𝑠
𝐿
14
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
a. Mathematical approach
The windowing process has two major effects:
- Reducing the frequency resolution of the computed spectrum, in thesense that the smallest resolvable frequency difference is limited by thelength of the data record, that is, ∆𝑓 = 1 𝑇𝐿 .
- Introducing spurious high-frequency components into the spectrum,which are caused by the sharp clipping of the signal 𝑥 𝑛 at the left andright ends of the rectangular window. This effect is referred to as“frequency leakage”.
15
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
b. Windowing
Requirement: suppressing the sidelobes as much as possible becausethey may be confused with the main lobes of weaker sinusoids that mightbe present.
16
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
b. Windowing
The standard technique for suppressing the sidelobes is to use a non-rectangular window – a window that cuts off to zero less sharply andmore gradually than the rectangular one.
• Hamming window:
𝑤 𝑛 = 0.54 − 0.46 cos 2𝜋𝑛
𝐿−1, if 0 ≤ 𝑛 ≤ 𝐿 − 1
0, otherwise
Because of the gradual transition to zero, the high frequencies that areintroduced by the windowing process are deemphasized. (The sidelobes are stillpresent, but are barely visible because they are suppressed relative to the mainlobeby 40dB).
The main tradeoff in using any type of non-rectangular window is that its mainlobebecomes wider and shorter, thus reducing the frequency resolution capability ofthe windowed spectrum.
17
Digital signal processing Chapter 5
1. Frequency Resolution and Windowing
b. Windowing
• Hamming window:
𝑤 𝑛 = 0.54 − 0.46 cos 2𝜋𝑛
𝐿−1, if 0 ≤ 𝑛 ≤ 𝐿 − 1
0, otherwise
For any type of window, the effective width of the mainlobe is still inverselyproportional to the window length:
∆𝑓𝑤 = 𝑐𝑓𝑠𝐿
= 𝑐1
𝑇𝐿
where the constant c depends on the window used and is always 𝑐 ≥ 1.
18
Digital signal processing Chapter 5
2. DTFT Computation
a. Discrete-time Fourier Transform (DTFT)
The Fourier transform of the finite-energy discrete-time signal 𝑥 𝑛 isdefined as:
𝑋 𝜔 =
𝑛=−∞
∞
𝑥 𝑛 𝑒−𝑗𝜔𝑛
where 𝜔 = 2𝜋𝑓 𝑓𝑠
The spectrum 𝑋 𝜔 is in general a complex-valued function of frequency:
𝑋 𝜔 = 𝑋 𝜔 𝑒𝑗𝜃 𝜔
where 𝜃 𝜔 = arg 𝑋 𝜔 with −𝜋 ≤ 𝜃 𝜔 ≤ 𝜋
𝑋 𝜔 : is the magnitude spectrum
𝜃 𝜔 : is the phase spectrum
19
Digital signal processing Chapter 5
2. DTFT Computation
a. Discrete-time Fourier Transform (DTFT)
𝑋 𝜔 is periodic with a period of 2𝜋
𝑋 𝜔 + 2𝜋𝑘 =
𝑛=−∞
∞
𝑥 𝑛 𝑒−𝑗 𝜔+2𝜋𝑘 𝑛 =
𝑛=−∞
∞
𝑥 𝑛 𝑒−𝑗𝜔𝑛 = 𝑋 𝜔
The frequency range for discrete-time signal is unique over the frequencyinterval −𝜋, 𝜋 or equivalently 0,2𝜋 .
Remarks: Spectrum of discrete-time signals is continuous and periodic.
20
Digital signal processing Chapter 5
2. DTFT Computation
b. Inverse discrete-time Fourier transform (IDTFT)
Given the frequency spectrum 𝑋 𝜔 , we can find the 𝑥 𝑛 in time-domainas:
𝑥 𝑛 =1
2𝜋 −𝜋
𝜋
𝑋 𝜔 𝑒𝑗𝜔𝑛𝑑𝜔
which is known as inverse discrete-time Fourier transform (IDFT).
21
Digital signal processing Chapter 5
2. DTFT Computation
c. Properties of DTFT
Symmetry: if the signal 𝑥 𝑛 is real, it easily follows that: 𝑋 𝜔 = 𝑋 −𝜔
or equivalently: 𝑋 −𝜔 = 𝑋 𝜔 (even symmetry)
arg 𝑋 −𝜔 = −arg 𝑋 𝜔 (odd symmetry)
We conclude that the frequency range of real discrete-time signalscan be limited further to the range 0 ≤ 𝜔 ≤ 𝜋 or 0 ≤ 𝑓 ≤ 𝑓𝑠 2.
Energy density of spectrum: the energy relation between 𝑥 𝑛 and 𝑋 𝜔is given by Parseval’s relation
𝐸𝑥 =
𝑛=−∞
∞
𝑥 𝑛 2 =1
2𝜋 −𝜋
𝜋
𝑋 𝜔 2𝑑𝜔
𝑆𝑥𝑥 𝜔 = 𝑋 𝜔 2 is called the energy density spectrum of 𝑥 𝑛 .
22
Digital signal processing Chapter 5
2. DTFT Computation
c. Properties of DTFT
The relationship of DTFT and z-transform: if 𝑋 𝑧 converges for 𝑧 = 1,then
𝑋 𝑧𝑧=𝑒𝑗𝜔
=
𝑛=−∞
∞
𝑥 𝑛 𝑒−𝑗𝜔𝑛 = 𝑋 𝜔
Linearity:
if 𝑥1 𝑛 𝐹
𝑋1 𝜔
𝑥2 𝑛 𝐹
𝑋2 𝜔
then 𝑥1 𝑛 + 𝑥2 𝑛 𝐹
𝑋1 𝜔 + 𝑋2 𝜔
Time-shifting:
if 𝑥 𝑛 𝐹
𝑋 𝜔
then 𝑥 𝑛 − 𝑘 𝐹
𝑋 𝜔 𝑒−𝑗𝜔𝑘
23
Digital signal processing Chapter 5
2. DTFT Computation
c. Properties of DTFT
Time reversal:
if 𝑥 𝑛 𝐹
𝑋 𝜔
then 𝑥 −𝑛 𝐹
𝑋 −𝜔
Convolution theory:
if 𝑥1 𝑛 𝐹
𝑋1 𝜔
𝑥2 𝑛 𝐹
𝑋2 𝜔
then 𝑥1 𝑛 ∗ 𝑥2 𝑛 𝐹
𝑋1 𝜔 𝑋2 𝜔
24
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
• 𝑋 𝜔 is a continuous function of frequency and therefore, it is not acomputationally convenient representation of the sequence 𝑥 𝑛 .
• DFT will present 𝑥 𝑛 in a frequency-domain by samples of its spectrum𝑋 𝜔 .
• A finite-duration sequence 𝑥 𝑛 of length 𝐿 has a Fourier transform:
𝑋 𝜔 =
𝑛=0
𝐿−1
𝑥 𝑛 𝑒−𝑗𝜔𝑛
where 0 ≤ 𝜔 ≤ 2𝜋.
Sampling 𝑋 𝜔 at equally spaced frequency 𝜔𝑘 = 2𝜋𝑘𝑁, 𝑘 = 0,1, … , 𝑁 −
1 where 𝑁 ≥ 𝐿, we obtain N-point DFT of length L-signal:
𝑋 𝑘 = 𝑋2𝜋𝑘
𝑁=
𝑛=0
𝐿−1
𝑥 𝑛 𝑒−𝑗2𝜋𝑘𝑛
𝑁
• DFT presents the discrete-frequency samples of spectra of discrete-timesignals.
25
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
In principles, the two lengths L and N can be specified independently ofeach other:
• 𝐿 is the number of time samples in the data record and can even beinfinite.
• 𝑁 is the number of frequencies at which we choose to evaluate the DFT.
Most discussions of the DFT assume that 𝑳 = 𝑵.
• If 𝐿 < 𝑁, we can pad 𝑁 − 𝐿 zeros at the end of the data record the makeit of length 𝑁.
• If 𝐿 > 𝑁, we may reduce the data record to length 𝑁 by wrapping itmodulo-N.
26
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
a. Zero padding
Padding any number of zeros at the end of a signal has no effect on it DFT.For example, padding 𝐷 zeros will result into a length of (𝐿 + 𝐷) signal:
𝑥 = 𝑥0, 𝑥1, 𝑥2, … , 𝑥𝐿−1
𝑥𝐷 = 𝑥0, 𝑥1, 𝑥2, … , 𝑥𝐿−1, 0,0, … , 0
Because 𝑥𝐷 𝑛 = 𝑥 𝑛 for 0 ≤ 𝑛 ≤ 𝐿 − 1 and 𝑥𝐷 𝑛 = 0 for 𝐿 ≤ 𝑛 ≤ 𝐿 +𝐷 − 1, the corresponding DTFTs will remain the same:
𝑋𝐷 𝜔 =
𝑛=0
𝐿+𝐷−1
𝑥𝐷 𝑛 𝑒−𝑗𝜔𝑛 =
𝑛=0
𝐿−1
𝑥𝐷 𝑛 𝑒−𝑗𝜔𝑛 +
𝑛=𝐿
𝐿+𝐷−1
𝑥𝐷 𝑛 𝑒−𝑗𝜔𝑛
=
𝑛=0
𝐿−1
𝑥 𝑛 𝑒−𝑗𝜔𝑛 = 𝑋 𝜔
27
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
a. Zero padding
• With the assumption 𝑥 𝑛 = 0 for 𝑛 ≥ 𝐿, we can write the DFT asfollows:
𝑋 𝑘 =
𝑛=0
𝑁−1
𝑥 𝑛 𝑒−𝑗2𝜋𝑘𝑛/𝑁 ; 𝑘 = 0,1, … , 𝑁 − 1
• The sequence 𝑥 𝑛 can recover from the frequency samples by inverseDFT (IDFT)
𝑥 𝑛 =1
𝑁
𝑘=0
𝑁−1
𝑋 𝑘 𝑒𝑗2𝜋𝑘𝑛/𝑁 ; 𝑛 = 0,1, … , 𝑁 − 1
28
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
b. Matrix form of DFT
• By defining an 𝑁𝑡ℎ root of unity 𝑊𝑁 = 𝑒−𝑗2𝜋/𝑁, we can write DFT andIDFT as follows:
𝑋 𝑘 =
𝑛=0
𝑁−1
𝑥 𝑛 𝑊𝑁𝑘𝑛 ; 𝑘 = 0,1, … , 𝑁 − 1
𝑥 𝑛 =1
𝑁
𝑛=0
𝑁−1
𝑋 𝑘 𝑊𝑁−𝑘𝑛 ; 𝑛 = 0,1, … , 𝑁 − 1
29
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
b. Matrix form of DFT
• Let us define:
𝐱𝑁 =
𝑥 0𝑥 1
⋮𝑥 𝑁 − 1
and 𝐗𝑁 =
𝑋 0𝑋 1
⋮𝑋 𝑁 − 1
The N-point DFT can be expressed in matrix form as: 𝐗𝑁 = 𝑾𝑁𝐱𝑁 where
𝑊𝑁 =
1 1 1 ⋯ 11 𝑊𝑁 𝑊𝑁
2 ⋯ 𝑊𝑁𝑁−1
1 𝑊𝑁2 𝑊𝑁
4 ⋯ 𝑊𝑁2 𝑁−1
⋮ ⋮ ⋮ ⋱ ⋮
1 𝑊𝑁𝑁−1 𝑊𝑁
2 𝑁−1⋯ 𝑊𝑁
𝑁−1 𝑁−1
30
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
c. Modulo-N reduction
The modulo-N reduction or wrapping of a signal is defined by
• dividing the signal 𝐱 into contiguous non-overlapping blocks of length 𝑁
• wrapping the blocks around to be time-aligned with the first block
• adding them up
31
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
c. Modulo-N reduction
Ex: Determine the mod-4 and mod-3 reductions of the length-8 signalvector
𝐱 = [1,2, −2,3,4, −2, −1,1]
32
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
c. Modulo-N reduction
We may express the sub-block components in terms of the time samples ofthe signal 𝑥 𝑛 as follows:
𝑥𝑚 𝑛 = 𝑥 𝑚𝑁 + 𝑛 , 𝑛 = 0,1, … , 𝑁 − 1
The wrapped vector 𝐱 will be in this notation: 𝑥 𝑛 = 𝑥0 𝑛 + 𝑥1 𝑛 + 𝑥2 𝑛 + 𝑥3 𝑛 + ⋯
= 𝑥 𝑛 + 𝑥 𝑁 + 𝑛 + 𝑥 2𝑁 + 𝑛 + 𝑥 3𝑁 + 𝑛 + ⋯
or, more compactly,
𝑥 𝑛 =
𝑚=0
∞
𝑥 𝑚𝑁 + 𝑛
𝑛 = 0,1, … , 𝑁 − 1
33
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
c. Modulo-N reduction
The connection of the mod-N reduction to the DFT is the theorem that thelength-N wrapped signal 𝐱 has the same N-point DFT as the originalunwrapped signal 𝐱.
We define the DFT matrices 𝐀 and 𝐀 as follows: 𝐗 = 𝐀 𝐱𝐗 = 𝐀𝐱
The size of 𝑨 is 𝑁 × 𝑁.
The size of 𝐀 is 𝑁 × 𝐿.
In matrix form, it follows from the property that the 𝑁 × 𝑁 submatrices ofthe full 𝑁 × 𝐿 DFT matrix 𝐀 are all equal to the DFT matrix 𝐀.
34
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
c. Modulo-N reduction
These submatrices are formed by grouping the first N columns of A into thefirst submatrix, the next N columns into the second submatrix, and so on.The matrix elements of the mth submatrix will be:
𝐴𝑘,𝑚𝑁+𝑛 = 𝑊𝑁𝑘(𝑚𝑁+𝑛)
= 𝑊𝑁𝑘𝑚𝑁𝑊𝑁
𝑘𝑛
Using the property 𝑊𝑁𝑁 = 1, it follows that 𝑊𝑁
𝑘𝑚𝑁 = 1, and therefore:
𝐴𝑘,𝑚𝑁+𝑛 = 𝑊𝑁𝑘𝑛 = 𝐴𝑘𝑛 = 𝐴𝑘𝑛
Thus, in general, 𝐀 is partitioned in the form:
𝐀 = 𝐀, 𝐀, 𝐀, …
35
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
c. Modulo-N reduction
36
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
d. Properties of DFT
37
Properties Time-domain Frequency domain
Notation 𝑥 𝑛 𝑋 𝑘
Periodicity 𝑥 𝑛 + 𝑁 = 𝑥 𝑛 𝑋 𝑘 = 𝑋 𝑘 + 𝑁
Linearity 𝑎1𝑥1 𝑛 + 𝑎2𝑥2 𝑛 𝑎1𝑋1 𝑛 + 𝑎2𝑋2 𝑛
Circular time-shift 𝑥 𝑛 − 𝑙𝑁
𝑒−𝑗2𝜋𝑘𝑙/𝑁𝑋 𝑘
Circular convolution 𝑥1 𝑛 ⊛ 𝑥2 𝑛 𝑋1 𝑁 𝑋2 𝑁
Multiplication of two sequences
𝑥1 𝑛 𝑥2 𝑁1
𝑁𝑋1 𝑛 ∗ 𝑋2 𝑛
Parvesal’s theorem 𝐸𝑥 =
𝑛=0
𝑁
𝑥 𝑛 2 =1
𝑁
𝑘=0
𝑁−1
𝑋 𝑘 2
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
e. Circular shift
The circular shift of the sequence can be represented as the index moduloN:
𝑥′ 𝑛 = 𝑥 𝑛 − 𝑘, modulo N ≡ 𝑥 𝑛 − 𝑘𝑁
38
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
e. Circular convolution
The circular convolution of two sequences of length N is defined as:𝑥3 𝑚 = 𝑥1 𝑛 ⊛ 𝑥2 𝑛
𝑥3 𝑚 =
𝑛=0
𝑁−1
𝑥1 𝑛 𝑥2 𝑚 − 𝑛𝑁
𝑚 = 0,1, … , 𝑁 − 1
Ex: perform the circular convolution of the following two sequences𝑥1 𝑛 = 2,1,2,1𝑥2 𝑛 = 1,2,3,4
It can be shown from the below figure:
39
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
e. Circular convolution
40
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
e. Circular convolution
41
Digital signal processing Chapter 5
3. Discrete Fourier transform (DFT)
f. Use of the DFT in linear filtering
Suppose that we have a finite duration sequence 𝑥 = 𝑥0, 𝑥1, 𝑥2, … , 𝑥𝐿−1
which excites the FIR filter of order M.
The sequence output is of length 𝐿𝑦 = 𝐿 + 𝑀 samples.
If 𝑁 ≥ 𝐿 + 𝑀, N-point DFT is sufficient to present 𝑦 𝑛 in the frequencydomain, i.e,
Computation of the N-point IDFT must yield 𝑦 𝑛 .
Thus, with zero padding, the DFT can be used to perform linear filtering.
42
Digital signal processing Chapter 5
4. Fast Fourier Transform (FFT)
• N-point DFT of the sequence of data 𝑥 𝑛 of length N is given byfollowing formula:
𝑋 𝑘 =
𝑛=0
𝑁−1
𝑥 𝑛 𝑊𝑁𝑘𝑛 , 𝑘 = 0,1,2, … , 𝑁 − 1
where 𝑊𝑁 = 𝑒−𝑗2𝜋/𝑁
• In general, the data sequence 𝑥 𝑛 is also assumed to be complexvalued. The calculation of all N values of DFT requires 𝑁2 complexmultiplication and 𝑁 𝑁 − 1 complex additions.
• FFT exploits to symmetry and periodicity properties of the phase factor𝑊𝑁 to reduce to computational complexity:
- Symmetry: 𝑊𝑁𝑘+𝑁/2
= −𝑊𝑁𝑘
- Periodicity: 𝑊𝑁𝑘+𝑁 = 𝑊𝑁
𝑘
43
Digital signal processing Chapter 5
4. Fast Fourier Transform (FFT)
• Based on decimation, leads to a factorization of computations.
• Let us first look at the classical radix 2 decimation in time.
• First we split the computation between old and even samples:
𝑋 𝑘 =
𝑛=0
𝑁2
−1
𝑥 2𝑛 𝑊𝑁𝑘2𝑛 +
𝑛=0
𝑁2
−1
𝑥 2𝑛 + 1 𝑊𝑁𝑘 2𝑛+1
• Using the following property: 𝑊𝑁2 = 𝑊𝑁/2
• The N-point DFT can be rewritten:
𝑋 𝑘 =
𝑛=0
𝑁2−1
𝑥 2𝑛 𝑊𝑁/2𝑘𝑛 + 𝑊𝑁
𝑘
𝑛=0
𝑁2−1
𝑥 2𝑛 + 1 𝑊𝑁/2𝑘𝑛
for 𝑘 = 0,1, … , 𝑁 − 1
44
Digital signal processing Chapter 5
4. Fast Fourier Transform (FFT)
• Using the property that:
𝑊𝑁𝑘+𝑁/2
= −𝑊𝑁𝑘
• The entire DFT can be computed with only 𝑘 = 0,1, … ,𝑁
2− 1.
𝑋 𝑘 =
𝑛=0
𝑁2
−1
𝑥 2𝑛 𝑊𝑁/2𝑘𝑛 + 𝑊𝑁
𝑘
𝑛=0
𝑁2
−1
𝑥 2𝑛 + 1 𝑊𝑁/2𝑘𝑛
𝑋 𝑘 +𝑁
2=
𝑛=0
𝑁2−1
𝑥 2𝑛 𝑊𝑁/2𝑘𝑛 − 𝑊𝑁
𝑘
𝑛=0
𝑁2−1
𝑥 2𝑛 + 1 𝑊𝑁/2𝑘𝑛
45
Digital signal processing Chapter 5
4. Fast Fourier Transform (FFT)
a. Butterfly
• This leads to basic building block of the FFT, the butterfly:
46
DFT N/2
DFT N/2
x(0)
x(2)
x(N-2)
x(1)
x(3)
x(N-1)
X(0)
X(1)
X(N/2-1)
X(N/2)
X(N/2+1)
X(N-1)
WN0
WN1
WNN/2-1
-
-
-
We need:•N/2(N/2-1) complex ‘+’ for each N/2 DFT.•(N/2)2 complex ‘×’ for each DFT.•N/2 complex ‘×’ at the input of the butterflies.•N complex ‘+’ for the butter-flies.•Grand total:N2/2 complex ‘+’N/2(N/2+1) complex ‘×’
Digital signal processing Chapter 5
4. Fast Fourier Transform (FFT)
b. Recursion
• If 𝑁/2 is even, we can further split the computation of each DFT of size𝑁/2 into two computations of half size DFT. When 𝑁 = 2𝑟 this can bedone until DFT of size 2 (i.e. butterfly with two elements).
47
x(0)
x(4)
x(2)
x(6)
x(1)
x(5)
x(3)
x(7)
X(0)
X(1)
X(2)
X(3)
X(4)
X(5)
X(6)
X(7)
W80
W81
W82
W83
-
-
-
--
-
-
-
-
-
-
-
W80
W80
W82
W82
W80
W80
W80
W80
W80=1
1st stage2nd stage3rd stage
Digital signal processing Chapter 5
4. Fast Fourier Transform (FFT)
c. Shuffling the data, bit reverse ordering
• At each step of the algorithm, data are split between even and oddvalues. This results in scrambling the order.
48
Digital signal processing Chapter 5
4. Fast Fourier Transform (FFT)
c. Number of operations
• If 𝑁 = 2𝑟 , we have 𝑟 = log2 𝑁 stages. For each one we have:
- 𝑁2 complex ‘x’ (some of them are by ‘1’).
- N complex ‘+’.
• Thus the grand total of operations is:
- 𝑁2 log2 𝑁 complex ‘x’.
- 𝑁 log2 𝑁 complex ‘+’.
• Ex: Calculate 4-point DFT of 𝑥 = 1,3,2,3 ?
49