Estimate the Frequency Spectrum
Let’s go back to this problem:
x[n] x(nTs )
x(t )
F F0 ?
n
1
Fs
Ts
0
N 1
N TMAX FS
TMAX
We take N samples of a sinusoid (or a complex exponential) and we
want to estimate its amplitude and frequency by the FFT.
What do we get?
Take the FFT …
X [ k0 ]
x[n] x(nTs )
X [k ]
FFT
n
0
N 1
k
0
k0
N k0
Best Estimates based on FFT:
Frequency:
Amplitude:
0 k 0
2
rad
N
| A | 2
F0 0
Fs
F
k0 s
2
N
X [k0 ]
N
How good is this estimate?
Hz
N 1
… again recall what we did…
Take a complex exponential of finite length:
x[n] Ae j0n , n 0,...,N 1
then its DFT looks like this
X [k ] DFTx[n] A WN 0 k 2 , k 0,...,N 1
N
where we define
sinN / 2
WN ( )
sin / 2
This is important to understand how good the spectral estimate is.
See the plot of WN /N
WN ( )
N
1 sin N / 2
N sin / 2
N 32
1.5
Main Lobe
1
Side Lobes
0.5
0
-3
-2
-1
2 / N
0
1
2 / N
2
3
See the plot of WN /N in dB’s
WN () dB 20log10 WN ()
N 32
Main Lobe
Side Lobes
0
dB
-50
-100
-3
-2
-1
2 / N
0
1
2 / N
2
3
… and zoom around the main lobe
N=64
N=256
N=1024
0
-20
-40
-60
-0.2
-0.1
0
0.1
0.2
Main Lobe
The width of the Main Lobe decreases as the data length N increases
0dB
4
N
Side Lobes
Sidelobes are artifacts which don’t belong to the signal. As the data
length N increases,
• the height of the sidelobes stays the same;
• the height of the first sidelobe is 13dB’s below the maximum
13 dB
Effect on Frequency Resolution
Why all this is important?
1. It has an effect on the frequency resolution. Suppose you have a
signal with two frequencies
x[n] A1e j1n A2e j2n , n 0,...,N 1
and you take the DFT X [k ] DFTx[n] . See the mainlobes:
1 2
1 2
4
N
you can resolve
them (2 peaks)
1 2
4
N
you cannot resolve
them (1 peak)
1 2
Example
Consider the signal
x[n] 3.0e j 0.1n 2.0e j 0.2n , n 0,...,127
1 2
X [k ]
4
0.982
128
60
dB
40
20
0
-20
0
20
40
60
80
100
120
k
… zoom in
Consider the signal
x[n] 3.0e j 0.1n 2.0e j 0.2n , n 0,...,127
60
40
20
0
0
5
2
4
1 2
10
2
128
0.0982
15
2 4
20
2
0.1963
128
k
Another Example
Consider the signal
X [k ]
x[n] 3.0e j 0.1n 2.0e j 0.15n , n 0,...,127
1 2
60
4
0.982
128
40
dB
20
0
-20
0
20
40
60
80
100
120
Only One Peak: Cannot Resolve the two frequencies!!!
k
… take more data points …
… of the same signal
X [k ]
60
dB
40
x[n] 3.0e j 0.1n 2.0e j 0.15n , n 0,...,256
1 2
4
0.491
256
20
0
0
50
100
150
200
Two Peaks: Can Resolve the two frequencies.
250
k
… zoom in
Consider the signal
x[n] 3.0e j 0.1n 2.0e j 0.15n , n 0,...,256
60
50
40
30
20
10
0
5
4
10
6
1 4
15
2
0.0982
256
20
2 6
25
2
0.1473
256
k
Now the Sidelobes
Consider the signal
X [k ]
dB
x[n] 2.0e j 0.3n , n 0,...,255
60
40
20
These are all sidelobes!!!
0
0
50
100
150
200
250
k
… add a low power component
Consider the signal
X [k ]
dB
x[n] 2.0e j 0.3n 0.01e j 0.4n , n 0,...,255
60
40
20
0
0
50
100
150
200
250
k
Because of sidelobes, cannot see the low power frequency component.
Why we have sidelobes?
There reason why there are high frequency artifacts (ie sidelobes) is
because there is a sharp transition at the edges of the time interval.
Remember that the signal is just one period of a periodic signal:
Discontinuity!!!
x[n]
0
Discontinuity!!!
One Period
N 1
n
Remedy: use a “window”
A remedy is to smooth a signal to “zero” at the edges by multiplying
with a window
windowed
x[n]
xw [n]
data
data
4
2
2
1
0
0
-2
-4
0
-1
50
100
150
200
250
-2
0
w[n]
1
hamming
window
0.8
0.6
0.4
0.2
0
0
50
100
150
200
250
50
100
150
200
250
Use Hamming Window
Take the FFT of the “windowed data”:
dB
60
40
20
0
-20
-40
0
50
100
150
200
250
k
Use Hamming Window
… zoom in
dB
40
20
0
-20
10
12
20
17
Estimate two
frequencies
30
40
2
0.2945 rad
256
2
2 17
0.4172 rad
256
1 12
50
k