ASP MI Lecture 3 NonParametricSE 2017 DPM
ASP MI Lecture 3 NonParametricSE 2017 DPM
◦ Astronomy → periodicities
Sensor 1 Sensor 2
direct path
reflected path
Layer 1
Not really convenient for real–world signals ⇒ need for a signal model.
More natural: Can we estimate the spectrum from N samples of f (t),
that is
[f (0), f (1), . . . , f (N − 1)]
Aeω0te−ω0t = A
1 1−z −1 W ∗
with the transfer function (large N) H(z) = 1−z −1 W
= 1−2 cos θk z −1 +z −2
sin(N ωT /2) − N −1 ωT
W (ω) = e 2
sin(ωT /2)
1.5 1.5
1 1
0.5 0.5
t k
0 0
−0.5 −0.5
−1 −1
−1.5 −1.5
−2 −2
−2.5 −2.5
−10 −5 0 5 10 −10 −5 0 5 10
X(f)
X(f)
fs
−f h fh f −f h fh f s− f h f s+ f h f
0
◦ This distorts physical
−0.5
−1
meaning of information
−1.5
−2
◦ In signal processing,
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
we require faithful data
representation
Pe riodogram Powe r Spe c tral De nsity Estimate
50
48Hz
20Hz
12Hz
◦ Problem: the noise
0
1.2KHz
model is always all-pass
−50
Powe r
However,
2π
⇒ T f ixed → N increase
NT
2tmax 2tmaxωmax
N> ⇒ N>
T π
tmax × ωmax → time–bandwidth product of a signal.
Amplitude Spectrum
100
1
Amplitude
0
50
−1
f1 fmax
−2 0
0 0.5 1 0 10 20 30 40
Time (sec) Frequency (Hz)
tmax=0.836 sec, N=210 f1=15 Hz, fmax=25 Hz, ωmax=156 rad/s
2 300
Amplitude Spectrum
1
200
Amplitude
0
100
−1
−2 0
0 0.2 0.4 0.6 0.8 0 10 f1 20 f 30 40
max
Time (sec) Frequency (Hz)
Amplitude Spectrum
0.8 8
Amplitude
0.6 6
0.4 4
0.2 2
0 0
−40 −20 0 20 40 −1 −0.5 0 0.5 1
Sample Index Normalised Frequency
0.8
15
Amplitude
0.6
10
0.4
5
0.2
0 0
−40 −20 0 20 40 −1 −0.5 0 0.5 1
Sample Index Normalised Frequency
10
x(k) = sin(2π11k) + sin(2π17k) 8
6
It is difficult to determine how many distinct
4
sinewawes we have.
2
Bottom: A 3200-point DFT of an N = 32 0
−20 −10 0 10 20
long sampled (fs = 64Hz) sine Frequency [Hz]
High resolution DFT (mixed signal)
x(k) = sin(2π11k) + sin(2π17k)
15
−20
50Hz artefact picked up by EEG −30
leads −40
sidelobe
power (dB)
−50
−80
partially masked
−90
45 50 55
• Remedy: Use a windowing function frequency (Hz)
−30
around 50Hz. −40
power (dB)
• Window value is zero at the beginning −50
−70
– Multiply with the signal with a −80
fR f ×N 11 × 32 10
= = = 5.5
fs fs 64 8
6
the impulse at f = 11 Hz appears
between the DFT bins k = 5 and k = 6 4
0.6
0.8
0.5
0.6 0.4
0.4 0.3
0.2
0.2
0.1
0 0
−10 0 10 −10 0 10
Frequency (Hz) Frequency (Hz)
⇒ the area below the PSD (power spectral density) curve = Signal Power
◦ Model–based schemes
– assume that the measurement is generated by some prescribed
parametric form, for instance by a rational transfer function (filter)
driven by white Gaussian noise
WGN ⇒ FILTER ⇒ Measurement
+M M
1 X X
= lim E {x[k]x[l]} e−2πf (k−l)
M →+∞ 2M + 1 | {z }
k=−M l=−M rxx (k−l)
+M M
1 X X
= lim g(k − l)
M →+∞ 2M + 1
k=−M l=−M
P 2 P P
Note that i = j× k
In practice, we only have access to [x(0), . . . , x(N − 1)] data points (we
drop the expectation), then
N −1 2
1 X
P̂per (f ) = x[k]e−2πf k
N
k=0
Symbol ˆ denotes an estimate, since due to the finite N the ACF is imperfect
N
X +1
P̂per (eω ) = r̂xx(k)e−kω
k=−N +1
1
◦ Notice that r̂xx(k) = N x(k) ∗ x(−k)
1 1 2
P̂per (eω ) = X(eω )X ∗(eω ) = |X(eω )|
N N
PN −1
ω
where X(e ) = n=0 x(n)e−ωn. (this is a DTFT of x(n)).
◦ Pxx = PERIODOGRAM(X)
returns the PSD estimate of the signal specified by vector X in the
vector Pxx. By default, the signal X is windowed with a BOXCAR
window of the same length as X;
◦ PERIODOGRAM(X,WINDOW)
specifies a window to be applied to X. WINDOW must be a vector of
the same length as X;
◦ [Pxx,W] = PERIODOGRAM(X,WINDOW,NFFT)
specifies the number of FFT points used to calculate the PSD estimate.
◦ Variance
n o
lim V ar P̂per (f ) = 0
N →∞
R
we desire lim E P̂per (f ) − Px(f ) =0
N →∞
N
X −1
E {Pper (f )} = E{r̂xx(k)}e−2πf k
k=−(N −1)
N −1
X N − |k|
= rxx(k)e−2πf k = “wB (k) × rxx(k)00
N
k=−(N −1)
where rxx is the true ACF and the Bartlett (triangular) window is defined
by
1 − |k|
wB (k) = N ; |k| ≤ N
0; |k| > N − 1
Notice the maximum at n=0, and a slow decay towards the end of the sequence
N −1
F
X
··· −→ e−2πf k
| {z } k=0
0,...,N −1
N −1 2πf N
X 1 − e−2πf N e− 2 2 sin(πf N )
W (f ) = e−2πf k = = =
1 − e−2πf − 2πf
e 2 2sin(πf )
k=0
If the sampling is coherent, zeroes of the sinc functions all lie at multiplies
of 1/N , and hence the outputs of DFT are all zero except at f = ± N1 .
Behaves as sinc2
where h i2
1 sin πf N
WB (f ) = N sin πf .
In words, the expected value of the periodogram is the convolution of the
power spectrum Pxx(f ) with the Fourier transform of the Bartlett window,
and therefore, the periodogram is a biased estimate.
Since when N → ∞, WB (f ) → δ(0), the periodogram is asymptotically
unbiased
n o
lim E P̂per (f ) = Pxx(f )
N →∞
20 25
10
20
Magnitude (dB)
Magnitude (dB)
0
15
−10
10
−20
5
−30
−40 0
−50 −5
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi)
40 35
30 30
20
25
Magnitude (dB)
Magnitude (dB)
10
20
0
15
−10
10
−20
5
−30
−40 0
−50 −5
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi)
2 1 2 1 2
σw + A1 [WB (ω − ω1) + WB (ω + ω1)] + A2 [WB (ω − ω) + WB (ω + ω2)]
R
4 4
where
20
20
10
Magnitude (dB)
Magnitude (dB)
0 15
−10
10
−20
−30 5
−40
0
−50
−60 −5
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi)
30 30
20
25
10
Magnitude (dB)
Magnitude (dB)
20
0
−10 15
−20
10
−30
5
−40
−50 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi)
◦ The effect of the main lobe (its width) is to smear or smooth the
estimated spectrum shape
◦ From the previous slide: the width of the mainlobe causes the next peak
in the spectrum to be masked if the two peaks are not separated by
1/N - the spectral resolution
× e−2π[f1(k−l)+f2(m−n)]
N −1 N −1
1 X X 4 4
σ x = σ x
N2 m=0
k=0
0 10
10
−10 0
Magnitude (db)
Magnitude (db)
Magnitude (db)
0
−20 −10
−10
−30 −20
−20
−40 −30
−30
−50 −40
10 20 20
0 10
10
−10 0
Magnitude (db)
Magnitude (db)
Magnitude (db)
0
−20 −10
−10
−30 −20
−20
−40 −30
−30
−50 −40
◦ Variance refers to the “goodness” of the estimate, that is, whether the
power of the estimation error tend to zero when N → ∞.
~ We have shown that even for a very large window the variance of the
estimate is as large as the true PSD
~ This means that the periodogram is not a consistent estimator of
true PSD.
◦ Bias
n o 1
E P̂per (ω) = Px(ω) ∗ WB (ω)
2π
◦ Resolution
2π
∆ω = 0.89
N
◦ Variance
n o
V ar P̂per (ω) ≈ Px2(ω)
Windowing Averaging
Modified Periodogram Bartlett’s Method
+ Overlapping windows
Welch’s Method
∞ 2
1 X
P̂M (ω) = x[n]w[n]e−nω
NU n=−∞
1
PN −1
2
where N is the window length and U = n=0 |w[n]| is a constant,
N
and is defined so that P̂M (ω) is asymptotically unbiased.
In Matlab:
xw=x(n1:n2).*w/norm(w);
Pm=N * periodogram(xw);
w=hanning(N); w=bartlett(N);w=blackman(n);
1
Magnitude
−1 −1
dB
dB
dB
−1 10 10
10
0.5
0
10 20 30 40 50 60 −0.02 −0.01 0 0.01 0.02 −0.02 −0.01 0 0.01 0.02 −0.02 −0.01 0 0.01 0.02
Time sample Normalised frequency Normalised frequency Normalised frequency
Bartlett window (64 samples) Spectral leakage − 64−sample window Spectral leakage − 128−sample window Spectral leakage − 256−sample window
0 0 0
1.5 10 10 10
−1
10
1 −2
10
Magnitude
−2
10
dB
dB
dB
−3
0.5 10
−4
10
−1 −4
10 10
0
10 20 30 40 50 60 −0.02 −0.01 0 0.01 0.02 −0.02 −0.01 0 0.01 0.02 −0.02 −0.01 0 0.01 0.02
Time sample Normalised frequency Normalised frequency Normalised frequency
Hamming window (64 samples) Spectral leakage − 64−sample window Spectral leakage − 128−sample window Spectral leakage − 256−sample window
0 0 0
1.5 10 10 10
−1 −1
10 10
1
Magnitude
−2 −2
10 10
dB
dB
dB
−3 −3
0.5 10 10
−4
10 −4
10
−1
0 10
10 20 30 40 50 60 −0.02 −0.01 0 0.01 0.02 −0.02 −0.01 0 0.01 0.02 −0.02 −0.01 0 0.01 0.02
Time sample Normalised frequency Normalised frequency Normalised frequency
15 20
10 10
5
0
Magnitude (dB)
Magnitude (dB)
0
−10
−5
−20
−10
−30
−15
−40
−20
−25 −50
−30 −60
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi)
M −1 hM −1 i
−k
X X
= v(n)v(n − k) e , for v(k) = 0, k ∈
/ [0, M − 1]
k=−(M −1) n=0
This gives
M
X −1
w(k) = v(n)v(n − k) = v(k) ∗ v(k) ⇔ W (ω) ≥ 0 pos. semidefinit.
n=0
◦ Hann window
w = 0.5 * (1 - cos(2*pi*(0:m-1)’/(n-1)));
◦ Hamming window
w = (54 - 46*cos(2*pi*(0:m-1)’/(n-1)))/100;
◦ Blackman window
w = (42 - 50*cos(2*pi*(0:m-1)/(n-1)) +
+ 8*cos(4*pi*(0:m-1)/(n-1)))’/100;
Averaging
Reduction in
Variance
Tradeoff:
Frequency Resolution &
Variance Reduction
20 20 20
Magnitude (dB)
Magnitude (dB)
Magnitude (dB)
10 10 10
0 0 0
2 2 2
1 1 1
Magnitude (dB)
Magnitude (dB)
Magnitude (dB)
0 0 0
−1 −1 −1
−2 −2 −2
−3 −3 −3
−4 −4 −4
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi) Frequency (units of pi)
Ensemble averages
Magnitude (dB)
Magnitude (dB)
30 30 30
20 20 20
10 10 10
0 0 0
35 35 35
30 30 30
25 25 25
Magnitude (dB)
Magnitude (dB)
Magnitude (dB)
20 20 20
15 15 15
10 10 10
5 5 5
0 0 0
−5 −5 −5
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi) Frequency (units of pi)
Ensemble averages
Notice the variance – resolution trade–off!
Achieves a good
balance between
Resolution &
Variance
This way, successive segments are offset by D points and each segment is
L points long
N = L + D(K − 1)
K−1 2
1 X L−1
X
P̂W (ω) = w[n]x[n + iD]e−nω
KLU i=0 n=0
K−1
1 X (i)
P̂W (ω) = P̂ (ω)
K i=0 M
◦ Bias
n o 1 2
E P̂W (ω) = Px(ω) ∗ |W (ω)|
2πLU
25 25
20
20
15
Magnitude (dB)
Magnitude (dB)
15
10
10
5
5
0
0
−5
−10 −5
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
Frequency (units of pi) Frequency (units of pi)
−13
10
−14
10
−15
10
−15 −16
10 10
10 15 20 25 30 35 10 15 20 25 30 35
Frequency (Hz) Frequency (Hz)
−10 −12
10 10
−13
10
−14
10
−15
10
−15 −16
10 10
10 15 20 25 30 35 10 15 20 25 30 35
Frequency (Hz) Frequency (Hz)
The Periodogram
can also be
expressed as:
Autocorrelation Estimates
at large lags are unreliable
Lags:
Windowing
that is, we trade the reduction in the variance for a reduction in the
resolution (smaller number of ACF estimates used to calculate the PSD)
The main problem with periodogram is its high statistical variability. This
arises from:
◦ Figure of merit
M = ν × ∆ω
◦ Although each method differs in its resolution and variance, the overall
performance is fundamentally limited by the amount of data that
is available.
◦ the derived variance formulae are only illustrative for real–world signals
But also many opportunities: spectral coherency, spectral entropy, TF, ...
Next time: model based spectral estimation for discrete spectral lines
−20
2 −10
−30
0 −40 −20
−50
−30
−2 −60
−40
−70
−4
−80 −50
0 0.02 0.04 0.06 0.08 0.1 0 100 200 300 400 500 0 100 200 300 400 500
Frequency (Hz)
Frequency
time
M aaa t l aaa b
For every time instant “t”, the PSD is plotted along the vertical axis
Darker areas: higher magnitude of PSD
dB
dB
dB dB
20 20
3.5 3.5
30
30
3.0 20 3.0
20
10
2.5 2.5 10
Frequency, kHz
Frequency, kHz
0
2.0 2.0 0
-10
-10
1.5 1.5
-20
-20
1.0 1.0
-30
-30
-50
0.0 0.0
5 5
Ampl
Ampl
515.5028 ms 0
241.5745 ms 0
time
Blackman−Tukey (M=128): Mean (+ − std) Blackman−Tukey (M=32): Mean (+ − std) Blackman−Tukey (M=16): Mean (+ − std)
10 8
8
8
6
6 6
4 4
4
2
2
0 2
−2
0
0
−4
−6 −2 −2
−8
−4
0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6
Frequency Frequency Frequency
Welch (M=128): Mean (+ − std) Welch (M=32): Mean (+ − std) Welch (M=16): Mean (+ − std)
25 20
30 18
20 16
25
14
20 15 12
10
15
10 8
10 6
5 4
5
2
0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6
Frequency Frequency Frequency
Signal: ARMA(4,4), b=[1, 0.3544, 0.3508, 0.1736, 0.2401] a=[1, -1.3817, 1.5632, -0.8843, 0.4096]
Sometimes we only desire the correct position of the peaks # ARMA Spectrum Estimation
(a)
0
−0.2
# low spectral entropy 0.5 1 1.5 2 2.5 3
(b)
high spectral entropy 4
3
0.5 1 1.5 2 2.5 3
0
−0.5
clean speech, b) spectral 0.5 1 1.5 2 2.5 3
6.5
6.4
noise, d)spectral entropy of 6.3
0.5 1 1.5 2 2.5 3
Time (s)
(speech+noise)
Powe r
80
−20
0 60 0
40 −40
−1 20 −1
−60
0
−2 −20 −2 −80
0 100 200 300 400 500 600 −600 0 −400 100 −200200 0 300 200
400 400
500 600
600 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
Time sample Time
Timedesample
lay Normalised frequency
Sine wave Sinewave
Sine wave ACF Sinewave spectrum
2 400 2 50
1 200 1 0
Powe r
0 0 0 −50
−1 −200 −1 −100
−2 −400 −2 −150
0 100 200 300 400 500 600 −600 0 −400 100 −200200 0 300 400
200 500
400 600
600 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
Time sample Time
Timedesample
lay Normalised frequency
Expone ntially-de c aying sine wave Exponentially-decaying
Expone ntially-de sinewave
c aying sine wave ACF Exponentially-decaying sinewave spectrum
50
60
1 1
0
40
0.5 0.5
−50
Powe r
20
0 0 0 −100
−20 −150
−0.5 −0.5
−40 −200
−1 −1
−60 −250
0 100 200 300 400 500 600 −600 0 −400 100 −200200 0 300 400
200 500
400 600
600 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
Time sample Timedesample
Time lay Normalised frequency
dB
dB
dB dB
20 20
3.5 3.5
30
30
3.0 20 3.0
20
10
2.5 2.5 10
Frequency, kHz
Frequency, kHz
0
2.0 2.0 0
-10
-10
1.5 1.5
-20
-20
1.0 1.0
-30
-30
-50
0.0 0.0
5 5
Ampl
Ampl
515.5028 ms 0
241.5745 ms 0