The Rectangular Window MUS421/EE367B Lecture 3 FFT Windows Julius O. Smith III (
[email protected]) Center for Computer Research in Music and Acoustics (CCRMA) Department of Music, Stanford University Stanford, California 94305
In Lecture 0, we looked at the rectangular window: ( 1, |n| ≥ M2−1 ∆ wR (n) = 0, otherwise Zero−Phase Rectangular Window − M = 21
1
March 28, 2005 0.8
Amplitude
Outline • Rectangular, Hann, Hamming
0.6
0.4
• MLT Sine
0.2
• Blackman-Harris Window Family
• Kaiser
0 −20
• Chebyshev
−15
−10
−5
0 Time (samples)
5
10
15
20
The window transform was found to be sin M ω2 ∆ = M · asincM (ω) WR (ω) = sin ω2 where asincM (ω) denotes the aliased sinc function. ∆ sin(M ω/2) asincM (ω) = M · sin(ω/2)
• Bartlett • Poisson
• Gaussian
• Optimal Windows 1
(1)
2
This result is plotted below:
More generally, we may plot both the magnitude and phase of the window versus frequency:
DFT of a Rectangular Window of length M = 11 12
DFT of a Rectangular Window − M = 11
10
11
8
10 9
Amplitude
6
8 4
7
Amplitude
2
0
−2
−4
6 5 4 3
−3
−2
−1 0 1 Normalized Frequency ω (rad/sample)
2
3
2
PSfrag replacements Note that this is the complete window transform, not just ω/Ω its magnitude. We obtain real window transforms like this only for symmetric, zero-phase windows.
1
−3
−2
−1 0 1 Normalized Frequency ω (rad/sample)
M
2
3
Phase of Rectangular Window Transform (M = 11) 3.5343
3.1416
2.7489
2.3562
Phase (rad)
1.9635
1.5708
1.1781
0.7854
0.3927
PSfrag replacements ω/ΩM
3
Main Lobe
0
−0.3927
−3
−2
−1 0 1 Normalized Frequency ω (rad/sample)
4
2
3
In audio work, we more typically plot the window transform magnitude on a decibel (dB) scale:
Since the DTFT of the rectangular window approximates the sinc function, it should “roll off” at approximately 6 dB per octave, as verified in the log-log plot below:
DFT of a Rectangular Window − M = 11 0 DFT of a Rectangular Window − M = 20 0
−5 −6.0206
main lobe
Ideal −6 dB per octave line
−10
−12.0412
13 dB down −18.0618
Partial Main
sidelobes
sidelobes
Amplitude (dB)
Magnitude (dB)
−15
−20
−25
−24.0824
Lobe
−30.103
−36.1236
−42.1442
−30
−48.1648
−35
eplacements −40
nulls −3
(radians per sample)
PSfrag replacements
nulls −2
−1 0 1 Normalized Frequency ω (rad/sample)
2
3
ωT (radians per sample)
−54.1854
0.1
0.2
0.4 0.8 1.6 Normalized Frequency (rad/sample)
3.2
6.4
As the sampling rate approaches infinity, the rectangular window transform converges exactly to the sinc function. Therefore, the departure of the roll-off from that of the sinc function can be ascribed to aliasing in the frequency domain, due to sampling in the time domain.
5
Sidelobe Roll-Off Rate In general, if the first n derivatives of a continuous function w(t) exist (i.e., they are finite and uniquely defined), then its Fourier Transform magnitude is asymptotically proportional to constant (as ω → ∞) |W (ω)| → ω n+1 Proof: Papoulis, Signal Analysis, McGraw-Hill, 1977 Thus, we have the following rule-of-thumb: n derivatives ↔ −6(n + 1) dB per octave roll-off rate
(since −20 log10(2) = 6.0205999 . . .). This is also −20(n + 1) dB per decade.
To apply this result, we normally only need to look at the window’s endpoints. The interior of the window is usually differentiable of all orders. Examples: • Amplitude discontinuity ↔ −6 dB/octave roll-off
• Slope discontinuity ↔ −12 dB/octave roll-off
• Curvature discontinuity ↔ −18 dB/octave roll-off For discrete-time windows, the roll-off rate slows down at high frequencies due to aliasing. 7
6
In summary, the DTFT of the M -sample rectangular window is proportional to the ‘aliased sinc function’: ∆ sin(ωM T /2) asincM (ωT ) = M · sin(ωT /2) ≈
sin(πf M T ) ∆ = sinc(f M T ) M πf T
Some important points: ∆ 2π M
• Zero crossings at integer multiples of ΩM = ∆
where ΩM = 2π M = frequency sampling interval for a length M DFT
• Main lobe width is 2ΩM =
4π M
• As M gets bigger, the mainlobe narrows (better frequency resolution) • M has no effect on the height of the side lobes (Same as the “Gibbs phenomenon” for Fourier series) • First sidelobe only 13 dB down from main-lobe peak • Side lobes roll off at approximately 6dB per octave
• A phase term arises when we shift the window to make it causal, while the window transform is real in the zero-phase case (i.e., centered about time 0) 8
Generalized Hamming Window Family Consider the following picture in the frequency domain:
In terms of the rectangular window transform WR (ω) = M · asincM (ω) (zero-phase, unit-amplitude case), this can be written as: ∆
WH (ω) = αWR(ω) + βWR (ω − ΩM ) + βWR (ω + ΩM )
0.5
Using the Shift Theorem, we can take the inverse transform of the above equation:
0.4
0.3
wH = αwR(n) + βe−jΩM n wR(n) + βejΩM nwR(n) 2πn = wR (n) α + 2β cos M
Amplitude
0.2
0.1
0
eplacements ΩM
Choosing various parameters for α and β result in different windows in the generalized Hamming family, some of which have names.
−0.1
−0.2 −2.5
−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
2.5
ω/ΩM
We have added 2 extra aliased sinc functions (shifted), which results in the following behavior: • There is some cancellation of the side lobes • The width of the main lobe is doubled
10
9
Hann or Hanning or Raised Cosine
Hann window properties:
The Hann window is defined by the settings α = 1/2 and β = 1/4: 1 1 2 ΩM n wH (n) = wR(n) + cos(ΩM n) = wR (n) cos 2 2 2
• Mainlobe is 4ΩM wide
• 1st side lobe is at -31dB
• Side lobes roll off at approx. 18dB / octave Hamming
Hann Window, M = 21 1
This window is determined by optimizing over α and β in such a way as to reduce the worst-case side lobe level.
Amplitude
0.8 0.6
Doing this, results in the following values:
0.4 0.2 0
−20
−15
−10
−5
0 Time (samples)
5
10
15
20
• α = .54
• β = (1 − α)/2 (for unit time-domain peak amplitude)
0
eplacements
(radians per sample)
Hann
Magnitude (dB)
−10 −20 −31.5 dB
−30 −40 −50 −60 −70 −3
−2
2Ω −1 −2ΩM+1 0 1 M+1 Normalized Frequency (rad/sample)
11
2
3
12
Hamming Window
Hamming Window Properties
• Discontinuous “slam to zero” at endpoints
Hamming Window, M = 21 1
• main lobe is 4ΩM
Amplitude
0.8 0.6
• Roll off is approx. 6 dB / octave (aliased)
0.4
• 1st side lobe is improved over Hann
0.2 0
−20
−15
−10
−5
0 Time (samples)
5
10
15
20
0
Magnitude (dB)
−10 −20 −30 −40.6 dB
−40 −50 −60
eplacements
−70 −3
2Ω −1 −2ΩM−1 0 1 M−1 Normalized Frequency (rad/sample)
−2
(radians per sample)
2
3
• side lobes closer to “equal ripple”
Note: The Hamming window could also be called the “Chebyshev Generalized Hamming Window”. This is because the Hamming window minimizes the sidelobe level within the family. Chebyshev-type designs generally exhibit equiripple error behavior, since the worst-case error (sidelobe level in this case) is minimized.
13
14
Longer Hamming Window
Window Transform Summary
Hamming Window, M = 101 1
Window Transforms, Window length = 20 0 Magnitude (dB0)
Rectangular
−10 −20
0.6
−30 −40
0.4
−50 −60 −0.5
0.2 0 −100
−0.4
−0.3
−0.2 −0.1 0 0.1 0.2 Normalized Frequency (cycles per sample)
0.3
0.4
0.5
0
−80
−60
−40
−20
0 20 Time (samples)
40
60
80
100
Hanning
Magnitude (dB0)
Amplitude
0.8
−10 −20 −30
0
−40
eplacements
−50 −60 −0.5
−20 −30 −42.7 dB
−40
−0.3
−0.2 −0.1 0 0.1 0.2 Normalized Frequency (cycles per sample)
0.3
0.4
0.5
Hamming
−10
−50
−20 −30
−60
−40
−70 −3
(radians per sample)
−0.4
0 Magnitude (dB0)
Magnitude (dB)
−10
−2
−2Ω2Ω −1 0 1 M−1M−1 Normalized Frequency (rad/sample)
−50
2
3
−60 −0.5
−0.4
−0.3
−0.2 −0.1 0 0.1 0.2 Normalized Frequency (cycles per sample)
• Since the side-lobes nearest the main lobe are most affected by the Hamming optimization, we now have a larger frequency region over which the spectral envelope looks like that of the asinc function (an “aliased -6 dB/octave roll-off”). • The side-lobe level (-42.7 dB) is also improved over that of the shorter window (-40.6 dB). 15
16
0.3
0.4
0.5
The MLT Sine Window The Modulated Lapped Transform (MLT) uses the sine window : 1 π , n = 0, 1, 2, . . . , 2M − 1 . w(n) = sin n + 2 2M • Used in MPEG-1, Layer 3 (MP3 format), MPEG-2 AAC, MPEG-4
Blackman-Harris Window Family • The Blackman-Harris family of windows is basically a generalization of the Hamming family. • In the case of the Hamming family, we constructed a summation of 3 shifted sinc functions. • The Blackman/Harris family is derived by considering a more general summation of shifted sinc functions:
• Sidelobes 24 dB down
wB (n) = wR(n)
• Asymptotically optimal coding gain
L−1 X
αl cos(lΩM n)
l=0
∆
where ΩM = 2π/M , n = −(M − 1)/2, . . . (M − 1)/2 (M odd). Special Cases: • L = 1 ⇒ Rectangular • L = 2 ⇒ Generalized Hamming • L = 3 ⇒ Blackman Family
17
18
Frequency-Domain Implementation
Classic Blackman
The Blackman-Harris window family can be very efficiently implemented in the frequency domain as a (2L − 1)-point convolution with the spectrum of the unwindowed data. Examples: • Start with a length M rectangular window
• Take an M -point DFT
• Convolve the DFT data with the 3-point smoother [1/4, 1/2, 1/4] to implement a Hann window • Note that the Hann window requires no multiplies in linear fixed-point data formats
• Implement any Blackman window as a 5-point smoother in the frequency domain
The so-called “Blackman Window” is the specific case in which α0 = 0.42 α1 = 0.5, and α2 = 0.08 Properties: • Sidelobes roll off about 18dB per octave (as T → 0) • −58dB sidelobe level (worst case)
• One degree of freedom used to increase the roll-off rate from 6dB/octave to 18 dB per octave • One degree of freedom used to minimize sidelobes • One degree of freedom used to scale the window
Matlab: N = 101; L = 3; No2 = (N-1)/2; n=-No2:No2; ws = zeros(L,3*N); z = zeros(1,N); for l=0:L-1 ws(l+1,:) = [z,cos(l*2*pi*n/N),z]; end alpha = [0.42,0.5,0.08]; % Classic Blackman w = alpha * ws;
19
20
Classic Blackman Window and Transform Properties:
Classic Blackman Window: M = 51 1
• α0 = 0.4243801 α1 = 0.4973406, and α2 = 0.0782793.
Amplitude
0.8 0.6 0.4
• Side-lobe level 71.48 dB.
0.2 0
20
40
60
80 Time (samples)
100
120
• Side lobes roll off ≈ 6dB per octave in the absence of aliasing (like rectangular and Hamming).
140
0
• All degrees of freedom (scaling aside) are used to minimize side lobes (like Hamming).
−20 Magnitude (dB)
Three-Term Blackman-Harris
−40 −60
Matlab:
−80 −100 −120
100
200
300
400
500 600 Frequency (bins)
700
800
900
1000
N = 101; L = 3; No2 = (N-1)/2; n=-No2:No2; ws = zeros(L,3*N); z = zeros(1,N); for l=0:L-1 ws(l+1,:) = [z,cos(l*2*pi*n/N),z]; end % 3-term Blackman-Harris(-Nuttall): alpha = [0.4243801, 0.4973406, 0.0782793]; w = alpha * ws;
21
22
Three-Term Blackman-Harris Window and Transform
Longer Three-Term Blackman-Harris Window and Transform Three−Term Blackman−Harris Window: M = 301 1
0.8
0.8 Amplitude
Amplitude
Three−Term Blackman−Harris Window: M = 51 1
0.6 0.4
0
20
40
60
80 Time (samples)
100
120
140
0
0
−20
−20 Magnitude (dB)
Magnitude (dB)
0.4 0.2
0.2 0
0.6
−40 −60 −80
200
300
400 500 Time (samples)
200
400
600
800 1000 Frequency (bins)
600
700
800
−40 −60 −80 −100
−100 −120
100
−120
100
200
300
400
500 600 Frequency (bins)
23
700
800
900
1000
24
1200
1400
1600
900
Miscellaneous Windows
Power-of-Cosine
w(n) = wR (n) cos
L
πn M
,
M −1 M −1 n∈ − , 2 2
• L = 0, 1, 2, . . .
• first L terms of its Taylor expansion, evaluated at the endpoints are identically 0
Bartlett (“Triangular”)
|n| w(n) = wR (n) 1 − (M − 1)/2
• Convolution of two half-length rectangular windows
• Window transform is sinc2 =⇒
• roll-off rate ≈ 6(L + 1)dB/octave • L = 0 ⇒ Rectangular window
• First sidelobe twice as far down as rect (-26 dB)
• L = 1 ⇒ MLT sine window
2
• L = 2 ⇒ Hann window (“raised cosine” = “cos ”)
• L = 3 ⇒ Alternate Blackman (max roll-off rate) L
Thus, cos windows parametrize Lth-order Blackman-Harris windows configured so as to use all L degrees of freedom to maximize roll-off rate.
• Main lobe twice as wide as that of a rectangular window having the same length (same as that of a half-length rect used to make it) • Often applied to sample correlations of finite data • Also called the “tent function”
26
25
Poisson (“Exponential”) HP (z) = wP (n) = wR(n)e
∞ X
[w(n)h(n)]z −n
n=0
|n|
−α (M −1)/2
where: α determines the time constant ( τ =
M 2α
)
=
1
h(n)e
αn − M/2
n=0
=
Poisson Window M = 51
∞ h X ∞ X
∞ X
∆
h(n)(zr)−n
Amplitude
0.7 0.6 0.5
z - plane
0.4 0.3 alpha = 10
0.2 0.1 0
-20
-10
0 time (samples)
10
20
r
In the z-plane, the Poisson window has the effect of contracting the unit circle. Applied to a causal signal h(n) having z transform H(z), we have
27
28
α
(let r = e M/2 )
n=0
= H(zr)
alpha = 1
0.8
z −n
h(n)z −nr−n =
n=0
0.9
i
1
Hann-Poisson Window and Transform
Hann-Poisson (“No Sidelobes”)
Hann−Poisson Window, M = 21, Alpha = 2.0
|n| n 1 −α 1 + cos π e (M −1)/2 w(n) = 2 (M − 1)/2
1
Amplitude
0.8
• Poisson window times Hann window (exponential times raised cosine)
0.6 0.4 0.2
• “No sidelobes” for α ≥ 2
0
• Valuable for “hill climbing” optimization methods (gradient-based)
−20
−15
−10
−5
0 Time (samples)
5
10
15
20
Magnitude (dB)
0
Matlab: function [w,h,p] = hannpoisson(M,alpha) PSfrag replacements %HANNPOISSON - Length M Hann-Poisson window
−10
−20
−30
−40
−3
−2
−1
0
1
2
3
ωT (radians per sample)
Mo2 = (M-1)/2; n=(-Mo2:Mo2)’; scl = alpha / Mo2; p = exp(-scl*abs(n)); scl2 = pi / Mo2; h = 0.5*(1+cos(scl2*n)); w = p.*h;
30
Hann-Poisson Slope and Curvature
Slope and Curvature for Larger Alpha
Slope and Curvature of DTFT dB Magnitude, Hann−Poisson Window, M = 21, Alpha = 2.0
Slope and Curvature of DTFT dB Magnitude, Hann−Poisson Window, M = 21, Alpha = 3.0 0.02 dB Magnitude Slope
0.02 0.01 0 −0.01 −0.02 −0.03 −4
−3
−2
−1
0
1
2
3
0.01
0
−0.01
−0.02 −4
4
−3
−2
−1
0
ωT (radians per sample) 5
2
3
4
3
4
−5
x 10
2
0
PSfrag replacements −5 −4
1
ωT (radians per sample)
−5
−3
−2
−1
0
1
2
3
4
dB Magnitude Curvature
dB Magnitude Slope
0.03
dB Magnitude Curvature
eplacements
29
x 10
0
−2
−4 −4
−3
−2
−1
0
ωT (radians per sample)
31
1
2
ωT (radians per sample)
32
Kaiser M W (ωk ) = I0(β)
Question: How do we use all M degrees of freedom (sample values) in an M -point window w(n) to obtain W (ω) ≈ δ(ω) in some optimal sense? The Kaiser window maximizes the energy in the main lobe of the window.
main lobe energy max w total energy
The functions which maximize this ratio are known as prolate spheroidal wave functions. Kaiser discovered an approximation based upon Bessel functions: ! r 2 n I0 β 1− M/2 ∆ wK (n) = , − M2−1 ≤ n ≤ M2−1 I0 (β) 0, elsewhere
r
sinh
β2 −
r
β2 −
M ωk 2
M ωk 2
2
!
2
where I0 is a Bessel function of the first kind, and is equal to 2 ∞ X (x/2)k ∆ I0(x) = k! k=0 ∞ X
(Compare this with ex/2 =
k=0
(x/2)k .) k!
Note: Sometimes you see the Kaiser window ∆ parameterized by α where β = πα
The transform of this window is:
33
34
SLL vs Main Lobe Width for the Kaiser Window (α=0,0.5,1,...,4) −10
α=β=0
β = [0, 2, 4, 6, 8, 10]
−20
−30
Length 50 Kaiser windows, 6 betas between 0 and 10 1.2
Side Lobe Level (SLL)
−40
β=0
−50
1
−60
−70
0.8 β=2 Amplitude
−80
−90 α = 4.0 −100
1
1.5
2 2.5 3 3.5 Main lobe width in units of rectangular−window main−lobe widths
4
• β is equal to 1/2 ‘time-bandwidth product’
4.5
• β trades off side lobe level for main lobe width larger β ⇒ lower S.L.L., wider mainlobe
35
β = 10
0.6
0.4 β=4 0.2
0
0
5
10
15
20
25 30 Time (samples)
36
35
40
45
50
M = [20, 30, 40, 50]
Length 50 Kaiser windows, 6 betas between 0 and 10
Kaiser window transforms, 4 window lengths between 20 and 50, beta=4 0
β=0
−50
M = 20
−20 dB
dB
0
dB
−100 0 0
0.05
0.1
0.15 0.2 0.25 0.3 0.35 Normalized Frequency (cycles per sample)
0.4
0.45 β=2
−40
0.5
−60
−50
0
0.05
0.1 0.15 Normalized Frequency (cycles per sample)
0 0.45 β=4
0.5
−60 0.05
0.1
0.15 0.2 0.25 0.3 0.35 Normalized Frequency (cycles per sample)
0.4
0.15 0.2 0.25 0.3 0.35 Normalized Frequency (cycles per sample)
0.4
0.45 β=6
0.5
0.45 β=8
0.5
0.45 β = 10
0.5
0
0.05
0.1 0.15 Normalized Frequency (cycles per sample)
0
−50
0.2
0.25
M = 40
−20 0.05
0.1
−40 −60
−50 −100 0 0
0
0.05
0.1 0.15 Normalized Frequency (cycles per sample)
0 0.05
0.1
0.15 0.2 0.25 0.3 0.35 Normalized Frequency (cycles per sample)
0.4
−50 −100
M = 30
−20 dB
0.4
dB
dB
0.15 0.2 0.25 0.3 0.35 Normalized Frequency (cycles per sample)
0.25
−40
−100 0 0 dB
0.1
−50 −100 0 0
dB
0.05
0.2
0.2
0.25
M = 50
−20 dB
dB
−100 0 0
−40 0
0.05
0.1
0.15 0.2 0.25 0.3 0.35 Normalized Frequency (cycles per sample)
0.4
0.45
0.5
−60
0
0.05
0.1 0.15 Normalized Frequency (cycles per sample)
37
38
Kaiser Windows and Transforms
Chebyshev
0.2
0.25
Minimize the Chebyshev norm of the side lobes: ∆
minw k sidelobes(W ) k∞ = minw {maxω>ωc |W (ω)|}
α = [1, 2, 3] (β = [π, 2π, 3π]) 1
0 Magnitude (dB)
Amplitude
α=1 0.5
0 −50
0 Time (samples)
50
0 Time (samples)
Magnitude (dB)
Amplitude
−2
0
2
α=2 −50
−100
50
−2
0
2
ωT (radians per sample)
1
0 Magnitude (dB)
α=3 0.5
0 Time (samples)
α=3
|W (ω) |≤ cα , ∀|ω|≥ωc
Closed-Form Window Transform: cos M cos−1 β cos πk M W (ωk ) = , (|k| ≤ M − 1) cosh M cosh−1(β) 1 cosh−1(10α) , (α ≈ 2, 3, 4) β = cosh M [Note error in text, which says “β = cosh−1[· · · ]”] • Window w = IDFT(W ) [zero-phase case] or IDFT of (−1)k W (ωk ) for causal case
−50
−100
50
Alternatively, minimize main lobe width subject to a sidelobe spec: max(ωc) w
ωT (radians per sample) α=2
0 −50
−50
0
0.5
0 −50
α=1
−100
1
Amplitude
eplacements
β = [0, 2, 4, 6, 8, 10]
−2
0
2
ωT (radians per sample)
• α controls sidelobe level (“stopband ripple”): Side-Lobe Level in dB = −20α.
• smaller ripple ⇒ larger ωc
• see matlab function “chebwin(M,ripple)”
• also called the Dolph-Chebyshev Window
39
40
Chebyshev Window, Length 31, Ripple -40 dB
Chebyshev Window, Length 31, Ripple -200 dB
Length 31 Chebyshev window 1
0.8
0.8 Amplitude
Amplitude
Length 31 Chebyshev window 1
0.6 0.4
−20
−15
−10
−5
0 5 Time (samples)
10
15
20
0 −25
25
10
0
0
−50 Magnitude (dB)
Magnitude (dB)
0.4 0.2
0.2 0 −25
0.6
−10 −20 −30 −40
rip = 40.0 dB
−15
−10
−5
0 5 Time (samples)
10
15
20
25
−0.3
−0.2 −0.1 0 0.1 0.2 Normalized Frequency (cycles/sample)
0.3
0.4
0.5
−100 −150 rip = 200.0 dB
−200 −250
−50 −60 −0.5
−20
−0.4
−0.3
−0.2 −0.1 0 0.1 0.2 Normalized Frequency (cycles/sample)
0.3
0.4
−300 −0.5
0.5
−0.4
41
42
Chebyshev Window, Length 101, Ripple -40 dB
Chebyshev and Hamming Windows Compared
Length 101 Chebyshev window
DFT of Chebyshev and Hamming Window: M = 31, Ripple = −42 dB
1
0
Chebyshev Hamming
Amplitude
0.8
−10 0.6 0.4
−20
0 −60
−40
−20
0 Time (samples)
20
40
Magnitude (dB)
0.2
60
10
−30
−40
Magnitude (dB)
0
−50
−10 −20
−60
−30 −40
rip = 40.0 dB
−50 −60 −0.5
PSfrag replacements −0.4
−0.3
−0.2 −0.1 0 0.1 0.2 Normalized Frequency (cycles/sample)
0.3
0.4
0.5
−70 −3
ωT (radians per sample)
−2
−1 0 1 Normalized Frequency (rad/sample)
2
3
For the comparison, we set the ripple parameter for chebwin to 42 dB: window = [ chebwin(31,42)’ zeros(1,1024-31) ];
43
44
Gaussian
The Gaussian Window in Spectral Modeling
The Gaussian “bell curve” is the only smooth function that transforms to itself: 2 2 2 2 1 √ e−t /2σ ↔ e−ω /2(1/σ) σ 2π It also achieves the minimum time-bandwidth product σtσω = σ × (1/σ) = 1 when “width” of a function is defined as the square root of its second central moment. For even functions w(t), sZ ∞ ∆ t2w(t)dt. σt = −∞
• Since the true Gaussian function has infinite duration, in practice we must window it with some finite window, or at least truncate it. • Philippe Depalle suggests using a triangular window raised to some power α for this purpose.
eplacements
Special Property: On a dB scale, the Gaussian is quadratic ⇒ parabolic interpolation of a sampled Gaussian transform is exact. Conjecture: Quadratic interpolation of spectral peaks is generally more accurate on a log-magnitude scale (e.g., dB) than on a linear magnitude scale. This has been verified in a number of cases, and no counter-examples are yet known. Exercise: Prove this is true for the rectangular window.
Matlab for the Gaussian Window
function [w] = gausswin(M,sigma) n=(-(M-1)/2:(M-1)/2)’; w = exp(-n.*n./(2*sigma.*sigma));
• This choice preserves the absence of sidelobes for sufficiently large α. • It also preserves non-negativity of the transform 45
46
Gaussian Window and Transform
Optimal Windows Generally we desire
Gaussian Window, M = 21, Sigma = M/8 1
W (ω) ≈ δ(ω)
Amplitude
0.8 0.6
• Best results are obtained by formulating this as an FIR filter design problem.
0.4 0.2 0
−20
−15
−10
−5
0 Time (samples)
5
10
15
20
0 DTFT Parabola
Magnitude (dB)
−20
• In general, both time-domain and frequency-domain specifications are needed. • Equivalently, both magnitude and phase specifications are necessary in the frequency domain.
−40 −60 −80 −100
−3
−2
−1
0
1
2
3
ωT (radians per sample)
47
48
Optimal Windows for Audio Coding Recently, numerically optimized windows have been developed by Dolby which achieve the following objectives: • Narrow the window in time
• Smooth the onset and decay in time
• Reduce sidelobes below the worst-case masking threshold
Conclusion • There is rarely a closed form expression for an optimal window in practice. • The hardest task is formulating the ideal error criterion. • Given an error criterion, it is usually straightforward to minimize it numerically with respect to the window samples w.
Windows in Graphics On Windowing for Gradient Estimation in Volume Visualization 1
1
http://www.cg.tuwien.ac.at/studentwork/CESCG99/TTheussl/paper.html
49
50