elen 5346/4304 dsp and filter design fall 2008 1 lecture 4: frequency domain representation, dtft,...
Post on 11-Jan-2016
230 Views
Preview:
TRANSCRIPT
ELEN 5346/4304 DSP and Filter Design Fall 2008
1
Lecture 4: Frequency domain representation, DTFT, IDTFT, DFT, IDFT
Instructor: Dr. Gleb V. Tcheslavski
Contact: gleb@ee.lamar.edu
Office Hours: Room 2030
Class web site: http://ee.lamar.edu/gleb/dsp/index.htm
ELEN 5346/4304 DSP and Filter Design Fall 2008
2
Some history
Jean Baptiste Joseph Fourier was born in France in 1768. He attended the Ecole Royale Militaire and in 1790 became a teacher there. Fourier continued his studies at the Ecole Normale in Paris, having as his teachers Lagrange, Laplace, and Monge. Later on, he, together with Monge and Malus, joined Napoleon as scientific advisors to his expedition to Egypt where Fourier established the Cairo Institute.
In 1822 Fourier has published his most famous work: The Analytical Theory of Heat. Fourier showed how the conduction of heat in solid bodies may be analyzed in terms of infinite mathematical series now called by his name, the Fourier series.
ELEN 5346/4304 DSP and Filter Design Fall 2008
3
Frequency domain representation
0cos( ) a (co)sinusoidal inputnLet x A n
frequency
0 00 0( ) ( )
22 22j n jj njn j n
njA A
e e e eA A
x e e complex exponent of 0
complex exponent of -0
A sinusoidal signal is represented by TWO complex exponents of opposite frequencies in the frequency domain.
(4.3.1)
(4.3.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
4
Frequency domain representation (cont)
0 0 0 00 ( )j n j n k j k j nn k k
kn
k
jnLet x e h e hy H xe ee
: phase
jj H e
j j k jk
kmagnitude
The frequency respon H e h e H e ese
Iff it exists!
* *
*
:
j j
j n j n j nn n n
n n n
j H e j H e
j j
j j
j j
j j
real H e HFor a system h e h e h e
H e e H e
e
H e H e
H e H e
e
has a period of 2 jH e
(4.4.1)
(4.4.2)
(4.4.3)
(4.4.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
5
Frequency domain representation (cont 2)
For an arbitrary real LTI system:
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-100
-50
0
50
100
Normalized Frequency ( rad/sample)
Pha
se (
degr
ees)
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-15
-10
-5
0
5
10
Normalized Frequency ( rad/sample)
Mag
nitu
de (
dB)
Symmetric with respect to
Anti-symmetric with respect to
ELEN 5346/4304 DSP and Filter Design Fall 2008
6
Frequency domain representation (cont 3)
Combining (4.3.2) and (4.4.4) – back to our sinusoid!
0 0 0 0
0 00 0 0 0
0 00 0
0
Stady-state response:2 2
2 2
2
j j
j j
j j n j j nj jn
j H e j H ej j n j j nj j
j n H e j n H ej
A Ay e H e e e H e e real system
A Ae H e e e e H e e e
AH e e e
LTI filtering: 0 00cosj j
ny A H e n H e
due to the input
change due to the system
same as the input
from the input
phase change due to the system
Via design, we manipulate H(ej), therefore, hn, and, finally, manipulate the coefficients in the Linear Constant Coefficient Difference Equation (LCCDE)
(4.6.1)
(4.6.2)
(4.6.3)
(4.6.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
7
Frequency domain representation (cont 4)
LCCDE:0
0,
, 0
0
j nj nnn
tot n i ii
x e ny c ke
initial conditions
if the system is BIBO( ) , the frequency response existsj j nn n
n n
H e h e h
for large enough n:0
,j n
tot ny ke
0 0 00 0
0
( )n
j n k j k j nn k n k k
k k
j
n
j ny h e u e ee Hh e
(4.7.1)
(4.7.4)
(4.7.2)
(4.7.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
8
Frequency domain representation (cont 5)
for an LTI: 0, ,
j nn n n tr n ss nx e u y y y
We don’t need systems of order higher than 2: can always make cascades.
0 0, ( ) ,j j n
ss ny H e e exists only for LTI BIBO systems
for a real, LTI, BIBO system:
0 00 , 0cos( ) ( ) cos( ( )j j
n ss nx A n y A H e n H e
effects of filtering
We cannot observe ANY frequency components in the output that are not present in the input (in steady state). We may see less when ( ) 0rjH e
(4.8.1)
(4.8.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
9
Frequency domain representation (cont 6)
In continuous time:
{we want}t t t t tx s n y c s distortion less transmission signal noise const delay
( )( ) ( ) ( ) ( ) ( )j t j t j jt tY y e dt c s e d t e ce S H S
We need a constant magnitude and linear phase for the frequencies of interest.
Ideal filters:
0( )jH e 0( )jH e
LPF
0( )jH e
HPF
0( )jH e
BPF
0( )jH e
BSF
Ideal filters are non-realizable!
(4.9.1)
(4.9.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
10
CTFT and ICTFT
(4.10.1)
(4.10.2)
( ) ( )
1( ) ( )
2
j t
j t
X x t e dt
x t X e d
CTFT:
ICTFT:
Examples:
ELEN 5346/4304 DSP and Filter Design Fall 2008
11
DTFT
, ,j j nn
n
a complex funX e x ction periodic continuous one
if exists
(4.11.1)
What’s about convergence???
1. Absolute convergence:
1 i.e. converges absolutely or uniformlyjn n
n
if x l x X e
.
( ) lim 0k
j j nk n
n kabs er
j jkk
ror
Le X et X e x e X e
(4.11.4)
(4.11.5)
2
2 2
cos , sinj j j j j jre im
j j jre im
X e X e X e X e X e X e
X e X e X e
(4.11.2)
(4.11.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
12
DTFT (cont)
2
1 2
0
. , :
cos( )
n
nn
n
u
a are not l In fact they are not l x
A n
must be
2. Mean-square convergence:
lim 0
energy of the
j j
err
k
r
k
o
X e X e
The total energy of the error must approach zero, not an error itself!
(4.12.1)
Absolutely summable sequences always have finite energy. However, finite energy sequences are not necessary absolutely summable.
ELEN 5346/4304 DSP and Filter Design Fall 2008
13
IDTFT
2
2 ,j n
j pn
n
Let p is a period X e x e
11( ) ( )
2j j n
p
j j nnx XX e e d
pe e d
IDTFT:
(4.13.1)
(4.13.2)
Combining (4.11.1) and (4.12.2)1
2j l j n
n ll
x x e e d
( ) sin ( )1
2 ( )j n l
l l l n l nl l
n lx e d x x x
n l
(4.13.3)
(4.13.4)
jX e shows where xn “lives” in the frequency domain.
ELEN 5346/4304 DSP and Filter Design Fall 2008
14
Back to ideal filters
Ideal LPF:
0( )jH e
20
1
c
1, 0
0,
cjLP
c
H e
Using IDTFT:
,
s n1,
i1
2 2
c c c
c
j n j nj n c
LP n
e ee d
nh n
jn jn n
1. The response in (4.14.2) is not absolutely summable, therefore, the filter is not BIBO stable!
2. The response in (4.14.2) is not causal and is of an infinite length.
(4.14.1)
(4.14.2)
As a result, the filter in (4.14.1) is not realizable.Similar derivations show that none of the ideal filters in slide 9 is realizable.
ELEN 5346/4304 DSP and Filter Design Fall 2008
15
DTFT properties
0
0
0 0( )
:
:
:
:
j jn n
DTFT
j n jn n
DTFT
j n jn
DTFT
nD
Linearity ag bx aG e bX e
Shift in time g e G e
Shift in frequency e g G e
Differentiation n g
( )
* *
:
1:
2
1' :
2
j
TFT
j jn n
DTFT
j jn n
DTFT
j jn n
n
dG ej
d
Linear convolution g x G e X e
Periodic convolution g w G e W e d
Parseval s theorem g w G e W e d
(4.15.1)
(4.15.2)
(4.15.3)
(4.15.4)
(4.15.5)
(4.15.6)
continuous, periodic functions
(4.15.6)
ELEN 5346/4304 DSP and Filter Design Fall 2008
16
DTFTs of commonly used sequences
ELEN 5346/4304 DSP and Filter Design Fall 2008
17
DTFT examples
002 ( 2 )j n j
nDTFT
k
Let x e X e k 0 1 2 ( 2 )j
nDTFT
k
x X e k 1
11 1 2 ( 2 )
1j j j
n n n jDTFTl
u u U e e U e c le
½ of DC value of un1( 2 )
1n jDTFTl
u le
*
* *j n j n jn n
n n
h e h e H e
( )
( )
1 1
2 2
1
2
j n j j n j n j j nn n n n
n n n
j j
h g e H e e g e d H e g e d
H e G e d
(4.17.1)
(4.17.2)
(4.17.3)
(4.17.4)
(4.17.5)
(4.17.6)
ELEN 5346/4304 DSP and Filter Design Fall 2008
18
DTFT examples (cont)
We can re-work the Parseval’s theorem (4.15.6) as follows:
(
2
)
2 * 1
2
1
2j
hS
jn n
j
n
j
e
Energy HE h de ed HH e
energy density (spectrum)
Autocorrelation function:
*( ),
* * * j jn n l n l n l
jgg l g
DTFTl
n n
g g g g g gr G e G Se e
(4.18.1)
(4.18.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
19
DTFT examples (cont 2)
One obvious problem with DTFT is that we can never compute it since xn needs to be known everywhere! which is impossible! Therefore, DTFT is not practical to compute.
Often, a finite dimension LTI system is described by LCCDE:
0 0 0
0
0
0
N M N Mj i j j m j
i n i m n m i mDTFT
i m i m
j
j
Mj m
mjm
Nj i
ii
b eH e
a
a y b x a e Y e b e X e
Y e
X e e
(4.19.2)
practical (finite dimensions)
Prediction of steady-state behavior of LCCDE
(4.19.1)
ELEN 5346/4304 DSP and Filter Design Fall 2008
20
How to measure frequency response of an actual (unknown) filter?
1. Perform two I/O experiments:
0 0
0 0
( ) ( ) ( )0 0 ,
( ) ( ) ( )0 0 ,
1) cos( ) cos
2) sin( ) sin
j jc c cn n tr n
LTI
j js s sn n tr n
LTI
x A n y A H e n H e y
x A n y A H e n H e y
2. Analyze these measurements and form:
0
00
0
0
0
( )( ) ( )
( ) (
,
),
j
j
j nc sn n n
j n H ejc s
j H e
n
jntr n
n
n n tr n
x x jx Ae
y y jy A H e e y
Finallyy
H e e zx
That’s a good way to measure/estimate a frequency response for every .
(4.20.1)
(4.20.2)
(4.20.3)
(4.20.4)
(4.20.5)
ELEN 5346/4304 DSP and Filter Design Fall 2008
21
DFT and IDFT
Consider an N-sequence xn (at most N non-zero values for 0 n N-1)
1
20
, 0,1,..., 1k
Nj n j
n kk
n
n
j j
n Nn x e X eX e x e kX N
uniformly spaced frequency samples
(4.21.1)
21
0
, 0,1,..., 1N j kn
Nk n
n
X x e k N
(4.21.2)DFT:
Finite sum! Therefore, it’s computable.
2
Using notation:jN
NW e
(4.21.1) can be rewritten as:1
0
Nkn
k n Nn
X x W
1
0
: 0,1,., ..,1
1N
knn k N
n
IDFT n Nx X WN
(4.21.3)
(4.21.4)
(4.21.5)
Btw, DFT is a sampled version of DTFT.
ELEN 5346/4304 DSP and Filter Design Fall 2008
22
DFT and IDFT (cont)
Let us verify (4.21.5). We multiply both sides by l nNW
1 1 1 1 1( )
0 0 0 0 0
1 1N N N N Nl n kn l n k l n
n N k N N k Nn n k n k
x W X W W X WN N
1 1 1( )
0 0 0
1N N Nl n k l n
n N k Nn k n
x W X WN
1( )
0
, ,
0,
Nk l n
Nn
N for k l rN r is IntegerSince W
otherwise
1
0
Nl n
n N ln
x W X
(4.22.1)
(4.22.2)
(4.22.3)
(4.22.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
23
FFT
In the matrix form: N D TD x FX
where: 0 1 1[ ... ]TNx x x x time domain signal
0 1 1[ ... ]TNX X X X N DFT samples
1 2 1
2 4 2 ( 1)
1 2 ( 1) ( 1) ( 1)
1 1 1 1
1
1
1
NN N N
NN N N N
N N N NN N N
W W W
D W DFT mW W
W W W
atrix
1Nx D X IDFT
1 2 ( 1)
1 2 4 2 ( 1)
( 1) 2 ( 1) ( 1) ( 1)
1 1 1 1
11
1
1
NN N N
NN N N N
N N N NN N N
W W W
D W W WN
W W W
IDFT matrix
1 *1
N ND DN
(4.23.1)
(4.23.2)
(4.23.3)
(4.23.4)
(4.23.5)
(4.23.6)
(4.23.7)
This is actually FFT…
ELEN 5346/4304 DSP and Filter Design Fall 2008
24
Relation between DTFT and DFT
1. Sampling of DTFT
jn
DTFTLet x X e
2 , 0,1,... 1 point DFTkjjk k
kSample X e at k N N frequency samples X e Y N
N
, 0,1,..., 1k nIDFT
Y y n N
2k
kjj klN
k l Nl
Y X e X e xW
1 1 1( )
0 0 0
1 1 1N N Nkn kl kn k n l
n k N l N N l Nk k l l k
y Y W xW W x WN N N
, 0,1,..., 1n n Nm
mConsidering y x n N
(4.24.1)
(4.24.2)
(4.24.3)
yn is an infinite sum of shifted replicas of xn. Iff xn is a length M sequence (M N) than yn = xn. Otherwise, time-domain aliasing xn cannot be recovered!
ELEN 5346/4304 DSP and Filter Design Fall 2008
25
Relation between DTFT and DFT (cont)
2. DTFT from DFT by Interpolation
Let xn be a length N sequence:point
n kN DFT
x X
It’s possible to determine DTFT X(ej) from its uniformly sampled version uniquely!
Let us try to recover DTFT from DFT (its sampled version).
1 1 1 1 1 2
0 0 0 0 0
1 1 knN N N N N jj j n kn j n j nNn k N k
n n k k n
X e x e X W e X e eN N
2 1( 2 ) ( 2 )/21 22
( 2 / ) ( 2 )/20
2 2sin sin
1 2 22 21 sin sin
2 2
k k Nj N k j N kN j n jN N
j k N j k Nn
N k N ke e
Since e eN k N ke e
N N
2 11
2
0
112
0
sin1 2
1s
2sin
1 22
sin2
in2
k NN j NN jjk
k
Nk
k
N N
X e X e
k
e
NN
XN kN
(4.25.1)
(4.25.2)
(4.25.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
26
Relation between DTFT and DFT (cont 2)
3. Numerical computation of DTFT from DFT
Let xn is a length N sequence: jn
DTFTx X e
defined by N uniformly spaced samples
We wish to evaluate at more dense frequency scale. jX e
2 / , 0,1,..., 1,k k M k M where M N
1 1 2
0 0
k k
nN N j kj j n Mn n
n n
X e x e x e
1 12
, ,0 0
k
nM Mj kj knMl n l n M
n n
X e x e x W
No change in information, no change in DTFT… just a better “plot resolution”.
(4.26.1)
,
, 0 1
0, 1n
l n
x n Nx
N n M
Define: zero-padding (4.26.2)
(4.26.3)
ELEN 5346/4304 DSP and Filter Design Fall 2008
27
A note on WN
2
Recall that:jN
NW e
WN is also called an Nth root of unity, since
2
1jN
NW e
Re
Im
2
N
Re
Im
2nN
(4.27.1)
(4.27.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
28
DFT properties
1. Circular shiftxn is a length N sequence defined for n = 0,1,…N-1.
An arbitrary shift applied to xn will knock it out of the 0…N-1 range.Therefore, a circular shift that always keeps the shifted sequence in the range 0…N-1 is defined using a modulo operation:
0
0 0
0
0
, ( modulo0
, 1
, 0N
n n
c n n n N n nN n n
x n n Nx x x
x n n
0
0
0 0
1( )
0
1
0
1
1
N
Nk n n
k Nn nk
Nkn knkn
N k N N kDFT
k
x X WN
W X W W XN
(4.28.1)
(4.28.2)
nx 6 61 5n nx x
6 64 2n nx x
ELEN 5346/4304 DSP and Filter Design Fall 2008
29
DFT properties (cont)
2. Circular convolution
A linear convolution for two length N sequences xn and gn has a length 2N-1:1
,0
, 0 2 2N
L n m n mm
y g x n N
A circular convolution is a length-N sequence defined as:
1
,0
N
N
C n m n n n nn mm
y g x g x x g
N N
1 1 1 1 1( )
0 0 0 0 0
1
0
1 1
1
N
n m N
N N N N Nk n m km kn
m m k N l N k Nn mm m k k m
x
Nkn
k k N k kDFT
k
g x g X W gW X WN N
G X W G XN
(4.29.1)
(4.29.2)
(4.29.3)
Procedure: take two sequences of the same length (zero-pad if needed), DFT of them, multiply, IDFT: a circular convolution.
ELEN 5346/4304 DSP and Filter Design Fall 2008
30
DFT properties (cont 2)
Example:
j j nn
n
X e x e Take N frequency samples of (4.30.1) and then IDFT:
(4.22.
2 21 1
0 0
1( )
0
3)
1 1
1
n l rNr
N N j kl jkn knN Nk N l N N
k k l
Nk n
n
nl
l N rl
Nrk
X W x e W W eN N
x WN
x
x
aliased version of xn
(4.30.1)
(4.30.2)
The results of circular convolution differ from the linear convolution “on the edges” – caused by aliasing.To avoid aliasing, we need to use zero-padding…
ELEN 5346/4304 DSP and Filter Design Fall 2008
31
Linear filtering via DFT
Often, we need to process long data sequences; therefore, the input must be segmented to fixed-size blocks prior LTI filtering. Successive blocks are processed one at a time and the output blocks are fitted together…
n n ny h x
Assuming that hn is an M-sequence, we form an N-sequence (L - block length):
(4.31.1)
,
1
0n
m n
x mL n mL Lx
otherwise
We can do it by FFT: IFFT{FFT{x}FFT{h}}…
N >> M; L >> M; N = L + M - 1 and is a power of 2
Problem: DFT implies circular convolution – aliasing!
(4.31.2)
ELEN 5346/4304 DSP and Filter Design Fall 2008
32
Linear filtering via DFT (cont)
Next, we compute N-point DFTs of xm,n and hn, and form
, , 0,1,... 1m k k m k k NY H X
, ,m k m nIDFT
Y y
(4.32.1)
- no aliasing!
Since each data block was terminated with M -1 zeros, the last M -1 samples from each block must be overlapped and added to first M – 1 samples of the succeeded block.
An Overlap-Add method.
ELEN 5346/4304 DSP and Filter Design Fall 2008
33
Linear filtering via DFT (cont 2)
Alternatively:
Each input data block contains M -1 samples from the previous block followed by L new data samples; multiply the N-DFT of the filter’s impulse response and the N-DFT of the input block, take IDFT.
Keep only the last L data samples from each output block.
An Overlap-Save method.
The first block is padded by M-1 zeros.
ELEN 5346/4304 DSP and Filter Design Fall 2008
34
DFT properties: General
from Mitra’s book
Btw, g[n] = gn
ELEN 5346/4304 DSP and Filter Design Fall 2008
35
DFT properties: Symmetry
from Mitra’s book
xn is a real sequence
ELEN 5346/4304 DSP and Filter Design Fall 2008
36
DFT properties: Symmetry (cont)
from Mitra’s book
xn is a complex sequence
ELEN 5346/4304 DSP and Filter Design Fall 2008
37
N-point DFTs of 2 real sequences via a single N-point DFT
Let gn and hn are two length N real sequences.
*
*
1
21
2
N
N
k k k
k k k
G X X
H X Xj
Form xn = gn + jhn Xk
* *
N Nk N kNote that X X
(4.37.1)
(4.37.2)
(4.37.3)
(4.37.4)
ELEN 5346/4304 DSP and Filter Design Fall 2008
38
Summary
Algorithm Time Frequency
CTFT Continuous Continuous
DTFT Discrete Continuous
DFT Discrete Discrete
top related