ee480: digital signal processing
TRANSCRIPT
http://www.ee.unlv.edu/~b1morris/ee480/
Professor Brendan Morris, SEB 3216, [email protected]
EE480: Digital Signal Processing
Spring 2014
TTh 14:30-15:45 CBC C222
Frequency Analysis
15/04/28
Outline
β’ Fourier Series
β’ Fourier Transform
β’ Discrete Time Fourier Transform
β’ Discrete Fourier Transform
β’ Fast Fourier Transform
2
Fourier Series β’ Periodic signals
β« π₯ π‘ = π₯(π‘ + π0) β’ Periodic signal can be represented as a sum of an
infinite number of harmonically-related sinusoids
β« π₯ π‘ = πππππΞ©0π‘β
π=ββ β« ππ - Fourier series coefficients
Contribution of particular frequency sinusoid β« Ξ©0 = 2π/π0 - fundamental frequency β« π β harmonic frequency index
β’ Coefficients can be obtained from signal
β« ππ =1
π0 π₯ π‘ πβππΞ©0π‘π00
β« Notice π0 is the average over a period, the DC component
3
Fourier Series Example β’ Example 5.1
β’ Rectangular pulse train
β’ π₯ π‘ = π΄ βπ < π‘ < π0 πππ π
β’ ππ =π΄π
π0
sin πΞ©0π/2
πΞ©0π/2
β’ π = 1;
β’ Ξ©0 = 2π β1
π= 2Ο
β’ Magnitude spectrum is known as a line spectrum
β« Only few specific frequencies represented
4
-20 -10 0 10 20-0.2
0
0.2
0.4
0.6
0.8
1
1.2
frequency [rad/sec]
ck
-10 -5 0 5 10-0.2
0
0.2
0.4
0.6
0.8
1
1.2
frequency [Hz]
ck
Fourier Transform β’ Generalization of Fourier
series to handle non-periodic signals
β’ Let π0 β β
β« Spacing between lines in FS go to zero
Ξ©0 = 2π/π0
β’ Results in a continuous frequency spectrum
β« Continuous function
β’ The number of FS coefficients to create βperiodicβ function goes to infinity
β’ Fourier representation of signal
β« π₯ π‘ =1
2π π Ξ© ππΞ©π‘πΞ©β
ββ
β« Inverse Fourier transform
β’ Fourier transform
β« π Ξ© = π₯ t πβπΞ©π‘ππ‘β
ββ
β’ Notice that a periodic function has both a FS and FT
β« ππ =1
π0π(πΞ©0)
β« Notice a normalization constant to account for the period
5
Discrete Time Fourier Transform
β’ Useful theoretical tool for discrete sequences/signals
β’ DTFT
β« π π = π₯ ππ πβππππβπ=ββ
β« Periodic function with period 2π
Only need to consider a 2π interval 0,2π or [βπ, π]
β’ Inverse FT
β« π₯ ππ =1
2π π π ππππππ
βπππ
β« Notice this is an integral relationship
π π is a continuous function
Sequence π₯(π) is infinite length
6
Sampling Theorem β’ Aliasing β signal distortion
caused by sampling
β« Loss of distinction between different signal frequencies
β’ A bandlimited signal can be recovered from its samples when there is no aliasing
β« ππ β₯ 2ππ , Ξ©π β₯ 2Ξ©π
ππ , Ξ©π - signal bandwidth
β’ Copies of analog spectrum are copied at ππ intervals
β« Smaller sampling frequency compresses spectrum into overlap
7
Discrete Fourier Transform β’ Numerically computable transform used for
practical applications β« Sampled version of DTFT
β’ DFT definition
β« π π = π₯ π πβπ 2π/N πππβ1π=0
β« π = 0, 1,β¦ ,π β 1 β frequency index β« Assumes π₯ π = 0 outside bounds [0, π β 1]
β’ Equivalent to taking π samples of DTFT π(π) over the range [0, 2π] β« π equally spaced samples at frequencies ππ = 2ππ/π
Resolution of DFT is 2π/π
β’ Inverse DFT
β« π₯ π =1
π π π ππ 2π/N πππβ1
π=0
8
Relationships Between Transforms
9
Relationships Between Transforms
10
Relationships Between Transforms
11
12
DFT Twidle Factors β’ Rewrite DFT equation using
Eulerβs
β’ π π = π₯ π πβπ 2π/N πππβ1π=0
β’ π π = π₯(π)πβ1π=0 ππ
ππ β« π = 0,1, β¦ , π β 1
β« ππππ = πβπ 2π/π ππ =
cos2πππ
πβ π sin
2πππ
π
β’ IDFT
β’ π₯ π =1
π π π ππ 2π/N πππβ1
π=0
β’ π₯ π =1
π π(π)πβ1
π=0 ππβππ,
β« π = 0,1, β¦ , π β 1
β’ Properties of twidle factors
β« πππ - N roots of unity in
clockwise direction on unit circle
β« Symmetry
πππ+π/2
= βπππ , 0 β€ π β€
π
2β 1
β« Periodicity
πππ+π = ππ
π
β’ Frequency resolution
β« Coefficients equally spaced on unit circle
β« Ξ = ππ /π
13
DFT Properties β’ Linearity
β« π·πΉπ ππ₯ π + ππ¦ π = ππ π +ππ π
β’ Complex conjugate
β« π βπ = πβ(π)
1 β€ π β€ π β 1 For π₯ π real valued
β« Only first π + 1 coefficients are unique
β« Notice the magnitude spectrum is even and phase spectrum is odd
β’ Z-transform connection
β« π π = π π§ π§=ππ 2π/π π
β« Obtain DFT coefficients by evaluating z-transform on the unit circle at N equally spaced frequencies ππ = 2ππ/π
β’ Circular convolution
β« π π = π» π π(π)
β« π¦ π = β π β¨π₯(π)
β« π¦ π = β π π₯( π β π πππ π)πβ1π=0
Note: both sequences must be padded to same length
14
Fast Fourier Transform
β’ DFT is computationally expensive
β« Requires many complex multiplications and additions
β« Complexity ~4π2
β’ Can reduce this time considerably by using the twidle factors
β« Complex periodicity limits the number of distinct values
β« Some factors have no real or no imaginary parts
β’ FFT algorithms operate in π log2 π time
β« Utilize radix-2 algorithm so π = 2π is a power of 2
15
FFT Decimation in Time
β’ Compute smaller DFTs on subsequences of π₯ π
β’ π π = π₯(π)πβ1π=0 ππ
ππ
β’ π π =
π₯1(π)π/2β1π=0 ππ
π2π + π₯2(π)π/2β1π=0 ππ
π(2π+1)
β« π₯1 π = π(π) = π₯ 2π - even samples β« π₯2 π = β π = π₯(2π + 1) β odd samples
β’ Since ππ2ππ = ππ/2
ππ
β« π π = π₯1(π)π/2β1π=0 ππ/2
ππ + πππ π₯2(π)
π/2β1π=0 ππ/2
ππ
π/2-point DFT of even and out parts of π₯(π)
β« π π = πΊ π + ππππ»(π)
Full π sequence is obtained by periodicity of each π/2 DFT
16
FFT Butterfly Structure β’ Full butterfly (8-point) β’ Simplified structure
17
FFT Decimation β’ Repeated application of
even/odd signal split
β« Stop at simple 2-point DFT
β’ Complete 8-point DFT structure
18
FFT Decimation in Time Implementation
β’ Notice arrangement of samples is not in sequence β requires shuffling β« Use bit reversal to figure out pairing of samples in 2-bit DFT
β’ Input values to DFT block are not needed after calculation β« Enables in-place operation
Save FFT output in same register as input β« Reduce memory requirements
19
FFT Decimation in Frequency
β’ Similar divide and conquer strategy
β« Decimate in frequency domain
β’ π 2π = π₯ π ππ2πππβ1
π=0
β’ π 2π = π₯ π ππ/2πππ/2β1
π=0 + π₯ π ππ/2πππβ1
π=π/2
β« Divide into first half and second half of sequence
β’ π 2π =
π₯ π ππ/2πππ/2β1
π=0 + π₯ π +π
2π
π/2
π+π
2ππ/2β1
π=0
β’ Simplifying with twidle properties
β« π 2π = π₯ π + π₯ π +π
2ππ/2
πππ/2β1π=0
β« π 2π + 1 = πππ π₯ π β π₯ π +
π
2ππ/2
πππ/2β1π=0
20
FFT Decimation in Frequency Structure
β’ Stage structure
β’ Bit reversal happens at output instead of input
β’ Full structure
21
Inverse FFT
β’ π₯ π =1
π π(π)πβ1
π=0 ππβππ
β’ Notice this is the DFT with a scale factor and change in twidle sign
β’ Can compute using the FFT with minor modifications
β« π₯β π =1
π πβ(π)πβ1
π=0 ππππ
Conjugate coefficients, compute FFT with scale factor, conjugate result
For real signals, no final conjugate needed
β« Can complex conjugate twidle factors and use in butterfly structure
22
FFT Example β’ Example 5.10
β’ Sine wave with π = 50 Hz
β« π₯ π = sin2πππ
ππ
π = 0,1, β¦ , 128
ππ = 256 Hz
β’ Frequency resolution of DFT?
β« Ξ = ππ /π =256
128= 2 Hz
β’ Location of peak
β« 50 = πΞ β π =50
2= 25
23
10 20 30 40 50 600
10
20
30
40
50
60
Frequency index, k
Ma
gn
itu
de
0 50 100 150-6
-4
-2
0
2
4
6x 10
-16
sample n
err
or
Spectral Leakage and Resolution β’ Notice that a DFT is like windowing
a signal to finite length β« Longer window lengths (more
samples) the closer DFT π(π) approximates DTFT π π
β’ Convolution relationship
β« π₯π π = π€ π π₯ π
β« ππ π = π π β π π
β’ Corruption of spectrum due to window properties (mainlobe/sidelobe) β« Sidelobes result in spurious peaks
in computed spectrum known as spectral leakage
Obviously, want to use smoother windows to minimize these effects
β« Spectral smearing is the loss in sharpness due to convolution which depends on mainlobe width
β’ Example 5.15 β« Two close sinusoids smeared
together
β’ To avoid smearing: β« Frequency separation should be
greater than freq resolution
β« π >2π
Ξπ, π > ππ /Ξπ
24
10 20 30 40 50 600
10
20
30
40
50
60
70
Frequency index, kM
ag
nitu
de
Power Spectral Density β’ Parsevalβs theorem
β’ πΈ =
π₯ π 2 =1
π π π 2πβ1
π=0πβ1π=0
β« π π 2 - power spectrum or periodogram
β’ Power spectral density (PSD, or power density spectrum or power spectrum) is used to measure average power over frequencies
β’ Computed for time-varying signal by using a sliding window technique β« Short-time Fourier transform
β« Grab π samples and compute FFT Must have overlap and use
windows
β’ Spectrogram β« Each short FFT is arranged as a
column in a matrix to give the time-varying properties of the signal
β« Viewed as an image
25
0.5 1 1.5 2 2.5 30
500
1000
1500
2000
2500
3000
3500
4000
Time
Fre
qu
en
cy (
Hz)
βShe had your dark suit in greasy wash water all yearβ
Fast FFT Convolution
β’ Linear convolution is multiplication in frequency domain
β« Must take FFT of signal and filter, multiply, and iFFT
β« Operations in frequency domain can be much faster for large filters
β« Requires zero-padding because of circular convolution
β’ Typically, will do block processing
β« Segment a signal and process each segment individually before recombining
26