lecture 4 4-1 copyright 1998, texas instruments incorporated all rights reserved use of frequency...
TRANSCRIPT
LECTURE 4 4-1Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Use of Frequency Domain
Telecommunication Channel |A|
ffc
Frequency Response
Signal frequencies > fc are attenuated and distorted|A|
f
JOHN’S “A”
IAN’S “A”
SPEECH ANALYSIS RECOGNITION IDENTIFICATION
Spectrum analyzers convert a time-domain signal into frequency domain
LECTURE 4 4-2Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Fourier Series
Tp
Original Signal xp(t) First 4 Terms of Fourier SeriesSum of First 4 Terms of Fourier Series and xp(t)
Original xp(t)
First 4 Terms of Fourier Series
Periodic signal expressed as infinite sum of sinusoids.
Ck’s are frequency domain amplitude and phase representationFor the given value xp(t) (a square value), the sum of the first four terms of
trigonometric Fourier series are:
xp(t) 1.0 + sin(t) + sin(3t) + sin(5t)
dte)t(xT
1c
where,ec)t(x
p
0
0
T
tjkp
pk
k
tjkkp
LECTURE 4 4-3Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Fourier Transform
Ck =1
Tp
Tp/2
-Tp/2
x(t) e-j(kt) dtWHERE
C() = d2 x(t) e-j t dt
Increase TP = Period Increases No Repetition1
Tp
=2
d2
k 0
Discrete coefficients Ck become continuous C()
Discrete frequency variable becomes continuous
x(t) e -jt dt
C()
d2= X() =
X() e jt d
x(t) =1
2
normalize
INVERSE
FT PAIR
x(t) = Ckej(k0 t)
k=-
TP
LECTURE 4 4-4Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Discrete Time Fourier Transform
Replace t with Tsn Continuous x(t) becomes discrete x(n) Sum rather than integrate all discrete samples
Fourier Transform
Limits of integration need not go beyond ± because the spectrum repeats itself outside ± (every 2)
Keep integration because X() is continuous
Discrete Time Fourier Transform
dte)t(x)(xtj
n
j n
e)n(x)(x
de)(x2
1)t(x
tj
de)(x2
1)n(x
)n(j
Inverse Fourier Transform
Inverse Discrete Time Fourier Transform
LECTURE 4 4-5Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Discrete Fourier Transformation
Recall DTFT Pair:
de)(X2
1)n(x
2
jn
n
jne)n(x)(X
To Make DTFT Practical:
There are an infinite number of time domain samples
is continuous
Take only N time domain samples
Sample the frequency domain, i.e. only evaluate x() at N discrete points. The equal spacing between points is = 2/N
The result is the Discrete Fourier Transform (DFT) pair:
FactorTwiddleeWwhere
W)k(XN
1)n(xandW)n(x)k(X
N
2j
N
1N
0k
kNN
1N
0n
kNN
nn
LECTURE 4 4-6Copyright 1998, Texas Instruments Incorporated All Rights Reserved
DFT Relationships
Time Domain Frequency Domain
N Samples
0
0
Ts
1
2Ts
2
3Ts
3 N-1
(N-1)Ts
|x(k)|
0
0
1 2 N/2 N-2 N-1
N
Fs
N
F2 s
2
Fs
N
F2 sN
Fs
N Samples
k
f
X(n)
t
n
LECTURE 4 4-7Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Practical Considerations
8-point DFT requires 8 2 = 64 multiplications
1000-point DFT requres 10002 = 1 million multiplications And all of these need to be summed
Standard DFT
An example of an 8 point DFT
Writing this out for each value of n
0k7W)0(x Each term such as requires 8 multiplications
Total number of multiplications required: 8 * 8 = 64Do not forget that each multiplication is complex
1Nk0,W)k(X)k(X1N
0n
knNnN
7,...,1,0k,W)7(x.......W)1(xW)0(x)k(X 7k7
1k7
0k7n
7,...,2,1,0k,W)k(X)k(X7
0n
kn7nn
LECTURE 4 4-8Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Fast Fourier TransformationSymmetry Property
Periodicity Property
THE FAST FOURIER TRANSFORM
Splitting the DFT in two
or
Manipulating the twiddle factor
kN
2/NkN WW
kN
NkN WW
2/N
)2/N
2(j)2
N
2(j2
N WeeW
1
2
N
0r
rk2N
12
N
0r
kN
rk2NN )W).(1r2(xW)W).(r2(x)k(X
1
2
N
0r
k)1r2(N
12
N
0r
rk2NN W).1r2(xW).r2(x)k(X
1
2
N
0r
12
N
0r
rk2N
kN
rk2Nn W)1r2(xWW)r2(x)k(X
LECTURE 4 4-9Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Time Savings
N/2 Multiplications
(N/2) 2 Multiplications (N/2) 2 Multiplications
For an 8-point FFT, 42 + 42 + 4 = 36 multiplications, saving 64 - 36 = 28 multiplications
For 1000 point FFT, 5002 + 5002 + 500 = 50,500 multiplications, saving 1,000,000 - 50,500 = 945,000 multiplications
Time savings assume 50ns cycle time 8-point FFT saves 1.2s
1000-point FFT saves 47.25ms
1
2
N
0r
rk2/N
kN
12
N
0r
rk2/NN W)1r2(xWW)r2(x)k(x
LECTURE 4 4-10Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Decimation in Time
Decimate once Called Radix-2 since we divided by 2
Splitting the original series into two is called decimation in time
n = {0, 1, 2, 3, 4, 5, 6, 7} n = { 0, 2, 4, 6 } and { 1, 3, 5, 7 }
Let us take a short series where N = 8
Decimate again
n = { 0, 4 } { 2, 6 } { 1, 5 } and { 3, 7 }
The result is a savings of N2 – (N/2)log2N multiplications
1024 point DFT = 1,048,576 multiplications1024 point FFT = 5120 multiplication
Decimation simplifies mathematics but there are more twiddle factors to calculate
A practical FFT incorporates these extra factors into the algorithm
LECTURE 4 4-11Copyright 1998, Texas Instruments Incorporated All Rights Reserved
4-Point FFT
x(n)
0
X4(k) = W4
kn3
Let us consider an example where N=4:
Decimate in time into 2 series: n = {0 , 2} and {1, 3}
+x(2r)
r=0
X4(k) =1 rk
W2W4
kx(2r+1)
r=01
rkW2
= [ x(0) + x(2) ] + [ x(1) + x(3) ]W2
kW4
kW2
k
We have two twiddle factors. Can we relate them?
WN = e
2N
-jk kREMEMBER:
2kW2
k= e
22
-j k*= W4
= e2
4-j 2k*
= [ x(0) + x(2) ] + [ x(1) + x(3) ]W4
2kW4
kW4
2k Now our FFT becomes:
LECTURE 4 4-12Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Flow Diagram
Represent with a flow diagram:
Write out values for k=0 only:
Two DFTs:
x(0)
x(1)
x(2)
x(3)
X4(0)0
0
0
0 W4
0=
= [ x(0) + x(2) ] + [ x(1) + x(3) ], k=0,1,2,3W4
2kW4
kW4
2k
= [ x(0) + x(2) ] + [ x(1) + x(3) ]W4
0W4
0W4
0
This is only one quarter of the flow diagram
X4(0)
X4(k)
x02
x13
LECTURE 4 4-13Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Full Flow Diagram
= [ x(0) + x(2) ] + [ x(1) + x(3) ]W4
2W4
1W4
2
= [ x(0) + x(2) ] + [ x(1) + x(3) ]W4
0W4
2W4
0
= [ x(0) + x(2) ] + [ x(1) + x(3) ]W4
2W4
3W4
2
= [ x(0) + x(2) ] + [ x(1) + x(3) ]W4
0W4
0W4
0
Write out all values for k:
SPOT THE BUTTERFLY ?
x(0)
x(1)
x(2)
x(3)
X4(0)
X4(1)
X4(2)
X4(3)
0
2
0
2 3
2
1
0
W4
6W4
224
-j= e
*6= -1 =
NOTICE
W4
4W4
024
-j= e
*4= 1 =
LECTURE 4 4-14Copyright 1998, Texas Instruments Incorporated All Rights Reserved
The Butterfly
W43 = j
W42 = -1
W41 = -j
W40 = 1
X0
X1
X3
X2
x3
x2
x1
x0
W40
W41
4 Point FFT Butterfly
X1
X2x2
WNk
x1 x1X1 = + WNk x2
x1X2 = – WNk x2
Typical Butterfly Twiddle Conversions
X0 = (x0 + x2) + W40 (x1+x3)
X1 = (x0 – x2) + W41 (x1–x3)
X2 = (x0 + x2) – W40 (x1+x3)
X3 = (x0 – x2) – W41 (x1–x3)
4 Point FFT Equationsa
b
LECTURE 4 4-15Copyright 1998, Texas Instruments Incorporated All Rights Reserved
A Practical Example
AMPLITUDE OF X1= 12+j2 = 2
X0=x0+ x2 + x1+x3
X1=x0–x2 + -j(x1–x3) = 1–0 + -j(0–1) = 1 + j
X2=(x0+ x2) – (x1+ x3) = (1 + 0) - (0 + 1) = 0
X3=(x0–x2)– -j (x1–x3) = (1–0)– -j(0–1) = 1– j
= 1 + 0 + 0 + 1 = 2
FFT Conversion
SAMPLED AT 10kHzTs= 100 uS
1
NTs
=F =
xk = {1,0,0,1}
Amplitude
Time0
1
2
(nTs)0 1 2 3
Time DomainAmplitude
Frequency
1
2
kHz
Frequency Domain
03 1 220-2.5 2.5 5.0-5.0
Frequency Spacing
LECTURE 4 4-16Copyright 1998, Texas Instruments Incorporated All Rights Reserved
DSP and FFT
Fast Fourier Transform is a generic name for reducing DFT computations. We considered Radix-2 here, but many other algorithms exist.
The simplified butterflies can be implemented with a DSP very efficiently Special FFT chips implement it even faster
But DSPs are programmable
And they can perform other operations on the signal
FFT requires address shuffling for faster data table access Most DSPs can perform shuffling in the background
Modern DSPs can perform an FFT of 1024 samples in well under 5 ms
LECTURE 4 4-17Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Summary Frequency domain information for a signal is important for
processing
Sinusoids can be represented by phasors
Fourier series can be used to represent any periodic signal
Fourier transforms are used to transform signals From time to frequency domain From frequency to time domain
DFT allows transform operations on sampled signals
DFT computations can be sped up by splitting the original series into two or more series
FFT offers considerable savings in computation time
DSPs can implement FFT efficiently
LECTURE 4 4-18Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Sliding Windows
Window is time shiftedby one sample
T
T
T
TT= 0Add new value
Input signal samplebuffer
Originalwindowed signal
New-old samplewindow
Next windowedsignal
Subtractold
T=N
Figure 1
Figure 2
Figure 3
Figure 4
T= 0
T
LECTURE 4 4-19Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Example Frequency Bin
N Delay
New Sample
K2 = K1N
-
+
Further Frequency
Bins
x[N-1] x K2
K1 x (X[k]*ej2n/N)
X[k]
K1 x ej2n/N
Old Sample
Note: K1=0.999
x[0]
LECTURE 4 4-20Copyright 1998, Texas Instruments Incorporated All Rights Reserved
The Phasor ModelIm = ImaginaryRe = Real
COMPLEX PLANE
PHASOR = VECTOR ROTATING
Amplitude = ASpeed = rad per second
Re
Im
A
a
b
x(t) = a + jb j = -1where
A = a2 + b2 = t = tan -1ba
and
1. Rectangular Form 2. Polar Form
e j(t) = cos(t) + j sin(t)
x(t) = Ae j(t) where
= 2f
= 180 degrees
LECTURE 4 4-21Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Modeling Sinusoids
Im
A
a
R/2
R/2
(t + ) OR(nTs + )LET sin= e j()- e - j()
2jTHEN
x(t) = R cos(t + )
x(t) = j(t + )
(e- j(t + )
+ eR2
)
Or as a sum of two phasors:
cos= e j()+ e - j()
2AND
Drawing the phasors for cos
In general:
e j() = cos() + jsin() e - j() = cos() - jsin()
REWRITE: e jt
ANDAS
b
-b
x(t) = R cos(t + )