EE422G Signals and Systems Laboratory Fourier Series and the DFT Kevin D. Donohue

advertisement
EE422G
Signals and Systems Laboratory
Fourier Series and the DFT
Kevin D. Donohue
Electrical and Computer Engineering
University of Kentucky
Fourier Series
http://www.gap-system.org/~history/PictDisplay/Fourier.html
Joseph Fourier
1768-1830
“In 1822, Joseph Fourier, a French
mathematician, discovered that
sinusoidal waves can be used as simple
building blocks to describe and
approximate any periodic waveform
including square waves. Fourier used it
as an analytical tool in the study of
waves and heat flow. It is frequently
used in signal processing and the
statistical analysis of time series.”
http://en.wikipedia.org/wiki/Sine_wave
Sum of Sines and Square Wave
Fourier Series analysis indicates that adding up odd harmonic
sine waves with zero phase and weighted by 1/n (where n is the
harmonic number) results in a square wave.
4 ∞
1
st = ∑
sin 2 t f 0 2n−1
 n=1 2n−1
Example for harmonics 1,3,5, and 7
Individual Components
1.5
1
1
0.5
0.5
Amplitude
Amplitude
Composite Waveforms
1.5
0
-0.5
-1
-1.5
0
-0.5
-1
0
0.2
0.4
0.6
Seconds
0.8
1
-1.5
0
0.2
0.4
0.6
Seconds
0.8
1
Sum of Sines and Square Wave
With 50 odd harmonics:
Composite Waveforms
1.5
Amplitude
1
0.5
0
-0.5
-1
-1.5
0
0.2
0.4
0.6
Seconds
0.8
1
The building of a square wave: Gibbs' effect
Dirichlet Conditions
Given x(t) periodic with period TF,
x(t) = x(t+nTF)  n I
and
1)
t o T F
∫t
o
∣x t ∣dt∞
(absolutely integrable).
2) x(t) has finite maxima and minima over a single period.
3) x(t) has a finite number of discontinuities all of finite size
over TF.
Fourier Series Definition
Then x(t) can be represented with a Fourier Series (FS):
∞
x t =
∑
X [k ]exp j 2 k f F t 
k=−∞
where (fundamental frequency)
1
f F=
TF
and complex Fourier series coefficient is:
X [k ]= 1
TF
t oT F
∫t
o
x texp− j 2 k f F tdt
Example
Find the FS of a periodic train of impulse functions.
∞
x t =T t=
F
∑
 t n T F 
n=−∞
Show result:
∞
∞
1
1
x t= ∑
exp j 2 k f F t = ∑ 2 cos2 k f F t 
T F k=1
k =−∞ T F
FS Numerical Computation
Apply rectangular rule for numerical integration of:
1
x t exp− j 2 k f F t  dt
X [ k ]=
T
TF
F
∫
Consider NF samples taken at TS intervals over period TF where
TF
N F=
Ts
Then summing up the areas of rectangles over the integrand
results in:
N F −1
1
1
X [ k ]≈
x nT s exp − j 2 k
nT s  T s
T F n=0
TF
∑
X [ k ]≈ 1
NF
N F −1
∑
n=0


  

− j 2 k n
x nT s exp
NF
for 0≤k  N F
Discrete Fourier Transform (DFT)
With minor changes, the numerical evaluation of the FS
coefficients become the DFT defined as:
X [ k ]=
N −1
∑
n=0

− j 2 k n
x [n]exp
N

for 0≤k  N
Example: Find the DFT for the 4-point sequence x[] = {1 0 -1 0}
Show X =[0, 2 j 0, 0, 2 j 0]
DFT Harmonics (N=4)
x(n) with kernel for k= 1
x(n) with kernel for k= 0
1
1
0.5
0.5
0
0
-0.5
-0.5
-1
0
1
2
Samples
3
4
-1
0
1
x(n) with kernel for k= 2
1
0.5
0.5
0
0
-0.5
-0.5
0
1
2
Samples
3
4
3
4
x(n) with kernel for k= 3
1
-1
2
Samples
3
4
-1
0
1
2
Samples
DFT Exercises
For each discrete sequence below,
compute the DFT by hand:
x[] = {1, 1, 1, 1, 0, 0, 0, 0}
x[] = {1, 0, -1, 0, 1, 0, -1, 0}
x[] = {1, 0, -1, 0, 0, 0, 0, 0}
Note that for N=8, the DFT kernel

2 n
exp − j
8

takes on only 8 possible complex number
evenly spaced (by 45º) on the unit circle.
1.5
1
1
2
j
1
 2
n=6
n=7
0.5
n=5
0
Also, check answers with Matlab using:
>> x = [1 1 1 1 0 0 0 0]
>> g = fft(x)
j
1
−1
j
2
2


n=0
−1
-0.5
-1
-1.5
-1.5
1
n=4
n=1
n=3
1
−1
−j
2
2


-1
-0.5
n=2
1
1
−j
2
2


−j
0
0.5
1
1.5
Inverse DFT (IDFT)
The inverse DFT can be obtained directly from the FS
expansion from it coefficients, where 0≤k N :
N −1
x t =
∑ X [ k ]exp j 2 k f
F
t
k=0
Sample time axis t=n T s and let
which results in the IDFT:
N −1
1
2 k n

x [n]=
X [k ]exp j
N k=0
N
∑


1
f F=
,
TF
for
Ts
1
= f F T s=
TF
N
0≤k N
by convention the 1/N scale factor is removed from the
DFT but used in the IDFT.
DFT Implications
Points outside of the [0, N-1] interval for x[n] are assumed to be
periodic since the FS was the starting point in the derivation.
Therefore, the DFT coefficients represent a periodic extension of
x[n] on [0, N-1].
x[n] = x[n+mN]  m I
Likewise the periodicity of the DFT kernel implies that the
sampled time signal at fs = 1/Ts on [0, TF] results in a periodic
extension of the spectrum or DFT coefficient on the interval
[0, N-1] or [0 fs) or [-fs/2, fs/2) (aliasing)
X [ k ]= X [ k mN ]  m I
IDFT Exercises
For each discrete sequence below,
compute the DFT by hand:
X [] = {1, 1, 1, 1}
X [] = {1, -j, -1, j}
X [] = {1, 0, -j, 0, -1, 0, j, 0}
Note that for N=8, the IDFT kernel

2 k
exp j
8

takes on only 8 possible complex number
evenly spaced (by 45º) on the unit circle.
1.5
1
1
2
k=2
0.5
j
1
 2
k=1
k=3
0
Also, check answers with Matlab using:
>> g = [1, -j, -1, j]
>> x = ifft(g)
j
1
−1
j
2
2


k=0
−1
k=7
-0.5
-1
-1.5
-1.5
1
k=4
k=5
1
−1
−j
2
2


-1
-0.5
k=6
−j
0
1
1
−j
2
2


0.5
1
1.5
Download