Windows
- window functions
DSP.Windows.rect
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀│
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
0 │ │
└──────────────────────────────────────────────────────────────────────┘
1 69
rect(n::Integer; padding::Integer=0, zerophase::Bool=false)
rect(dims; padding=0, zerophase=false)
Rectangular window of length n
, padded with padding
zeros. This window is 1 within the window, and 0 outside of it.
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.hanning
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▄▄▀▀▀▀▀▀▀▀▄▄ │
│ ▗▄▀ ▀▄▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▘ ▝▄ │
│ ▗▀ ▀▖ │
│ ▞▘ ▝▚ │
│ ▗▀ ▀▖ │
│ ▗▄▘ ▝▚▖ │
│ ▄▘ ▝▄ │
│ ▗▞ ▚▖ │
│ ▄▘ ▝▄ │
│ ▗▀ ▀▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▀▘ ▝▀▄ │
0 │▄▄▄▄▀▀ ▀▀▄▄▄▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
hanning(n::Integer; padding::Integer=0, zerophase::Bool=false)
hanning(dims; padding=0, zerophase=false)
Hanning window of length n
with padding
zeros. The Hanning (or Hann) window is a raised-cosine window that reaches zero at the endpoints.
The window is defined by sampling the continuous function:
1 + cos(2πx)
w(x) = ──────────── = cos²(πx)
2
in the range [-0.5, 0.5]
The hanning
window satisfies the Constant Overlap-Add (COLA) property with a hop of 0.5, which means that adding together a sequence of delayed windows with 50% overlap will result in a constant signal. This is useful when synthesizing a signal from a number of overlapping frames (each with a roughly rectangular window), to eliminate windowing amplitude modulation.
While this windowing function was originally named after its inventor Julius Von Hann, colloquial usage has adjusted to refer to it as the "Hanning" window, to better match the similarly-named "Hamming" window. Because of this, both hann()
and hanning()
are exported from this module.
Note that the hanning
window is the cosine
window squared.
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.hamming
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▄▞▀▀▀▀▀▀▀▀▚▄ │
│ ▗▞▀ ▀▚▖ │
│ ▗▞▘ ▝▀▄ │
│ ▗▞▘ ▚▖ │
│ ▞▘ ▝▚▖ │
│ ▄▀ ▀▄ │
│ ▄▞ ▚▄ │
│ ▗▞ ▚▖ │
│ ▞▘ ▝▚ │
│ ▄▀ ▀▄ │
│ ▗▞ ▚▖ │
│ ▄▞▘ ▝▚▄ │
│ ▗▄▀▘ ▀▄▖ │
│▄▄▄▞▀▘ ▝▀▚▄▄▄│
0 │ │
└──────────────────────────────────────────────────────────────────────┘
1 69
hamming(n::Integer; padding::Integer=0, zerophase::Bool=false)
hamming(dims; padding=0, zerophase=false)
Hamming window of length n
with padding
zeros. The Hamming window does not reach zero at the endpoints and so has a shallower frequency roll-off when compared to the Hanning window, but is designed to cancel the first side-lobe.
The window is defined by sampling the continuous function:
w(x) = 0.54 + 0.46*cos(2pi*x)
in the range [-0.5, 0.5]
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.tukey
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▗▞▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜▖ │
│ ▗▘ ▝▖ │
│ ▗▘ ▝▖ │
│ ▞ ▚ │
│ ▐ ▌ │
│ ▌ ▝▖ │
│ ▐ ▚ │
│ ▗▘ ▝▖ │
│ ▌ ▚ │
│ ▗▘ ▌ │
│ ▌ ▐ │
│ ▞ ▚ │
│ ▞▘ ▝▖ │
│ ▗▘ ▝▖ │
0 │▄▄▘ ▝▚▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
tukey(n::Integer, α::Real; padding::Integer=0, zerophase::Bool=false)
tukey(dims, α; padding=0, zerophase=false)
Tukey window of length n
with padding
zeros. The Tukey window has a flat top and reaches zero at the endpoints, with a sinusoidal transition area parameterized by α
. For α == 0
, the window is equivalent to a rectangular window. For α == 1
, the window is a Hann window.
The window is defined by sampling the continuous function:
⎛ ⎛2π ⎛ 1 - α⎞⎞
⎜ 1 + cos ⎜── ⎜x + ─────⎟⎟ 1 - α
⎜ ⎝ α ⎝ 2 ⎠⎠ x ≤ - ─────
⎜ ───────────────────────── 2
⎜ 2
⎜
⎜ 1 - α 1 - α
w(x) = ⎜ 1 - ───── < x ≤ ─────
⎜ 2 2
⎜
⎜ ⎛2π ⎛ 1 - α⎞⎞
⎜ 1 + cos ⎜── ⎜x - ─────⎟⎟ 1 - α
⎜ ⎝ α ⎝ 2 ⎠⎠ x > ─────
⎜ ───────────────────────── 2
⎝ 2
in the range [-0.5, 0.5]
Providing a dims
Tuple
rather than a single n
constructs a 2D window. α
, padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.cosine
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▄▄▀▀▀▀▀▀▀▀▀▀▀▀▄▄ │
│ ▗▄▀▀ ▀▀▄▖ │
│ ▄▀▘ ▝▀▄ │
│ ▗▞▀ ▀▚▖ │
│ ▄▀▘ ▝▀▄ │
│ ▄▀ ▀▄ │
│ ▗▞ ▚▖ │
│ ▞▘ ▝▚▖ │
│ ▄▀ ▝▄ │
│ ▗▞ ▚▖ │
│ ▄▘ ▝▄ │
│ ▗▞ ▚▖ │
│ ▄▘ ▝▄ │
│ ▗▞ ▚▖ │
0 │▄▘ ▝▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
cosine(n::Integer; padding::Integer=0, zerophase::Bool=false)
cosine(dims; padding=0, zerophase=false)
Cosine window of length n
with padding
zeros. The cosine window is the first lobe of a cosine function (with the zero crossings at +/- π as endpoints). Also called the sine window.
The window is defined by sampling the continuous function:
w(x) = cos(πx)
in the range [-0.5, 0.5]
Note that the cosine window is the square root of the hanning
window, so it is sometimes used when you are applying the window twice, such as the analysis and synthesis steps of an STFT.
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.lanczos
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▄▄▀▀▀▀▀▀▀▀▀▀▄▄ │
│ ▄▞▀ ▀▀▄ │
│ ▗▞▀ ▀▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▀▘ ▝▀▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▘ ▝▚ │
│ ▄▀ ▀▄ │
│ ▗▞▘ ▚▖ │
│ ▄▘ ▝▚ │
│ ▄▀ ▀▄ │
│ ▗▞ ▜▖ │
│ ▗▞▘ ▝▚▖ │
0 │▄▞▘ ▝▚▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
lanczos(n::Integer; padding::Integer=0, zerophase::Bool=false)
lanczos(dims; padding=0, zerophase=false)
Lanczos window of length n
with padding
zeros. The Lanczos window is the main lobe of a sinc
function.
The window is defined by sampling the continuous function:
sin(2πx)
w(x) = sinc(2x) = ────────
2πx
in the range [-0.5, 0.5]
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.triang
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▄▞▀▀▀▄▖ │
│ ▗▄▞▀ ▝▀▄▖ │
│ ▗▄▀▘ ▝▀▄▖ │
│ ▗▄▀▘ ▝▀▄▖ │
│ ▗▄▀▘ ▝▀▄▖ │
│ ▗▄▀▘ ▝▀▄▄ │
│ ▗▄▀▘ ▀▚▄ │
│ ▗▄▀▘ ▀▙▄ │
│ ▄▄▀▘ ▀▚▄ │
│ ▄▞▀ ▀▚▄ │
│ ▄▞▀ ▀▚▄ │
│▀ ▀│
│ │
│ │
0 │ │
└──────────────────────────────────────────────────────────────────────┘
1 7
triang(n::Integer; padding::Integer=0, zerophase::Bool=false)
triang(dims; padding=0, zerophase=false)
Triangular window of length n
with padding
zeros. The Triangular window does not reach zero at the endpoints. For odd n
the triang
window is the center n
points of an n+2
-point bartlett
window (i.e. the samples just outside the window would be zero). For even n
the window slope is the same as the n-1
window but delayed by a half sample so the zero points would be 1/2 sample past the ends of the window.
The window is defined by sampling the continuous function:
⎛ 2(n-1)
⎜1 - ────── abs(x) n is even
⎜ n
w(x) = ⎜
⎜ 2(n-1)
⎜1 - ────── abs(x) n is odd
⎝ n+1
in the range [-0.5, 0.5]
.
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
When zerophase
is true
substitute n+1
for n
in the above window expressions.
DSP.Windows.bartlett
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▗▞▀▀▚▖ │
│ ▄▞▘ ▝▚▄ │
│ ▄▀ ▀▄ │
│ ▗▄▀ ▀▄▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▞▘ ▝▚▄ │
│ ▄▀ ▀▄ │
│ ▄▄▀ ▀▚▄ │
│ ▄▀ ▀▄ │
│ ▗▞▀ ▀▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▀▘ ▝▀▄ │
│ ▄▀ ▀▄ │
│ ▗▞▀ ▀▚▖ │
0 │▄▞▘ ▝▚▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
bartlett(n::Integer; padding::Integer=0, zerophase::Bool=false)
bartlett(dims; padding=0, zerophase=false)
Bartlett window of length n
. The Bartlett window is a triangular window that reaches 0 at the endpoints. This is equivalent to convolving two rectangular windows of length (n-1)/2
and adding the zero endpoints. See triang
for a window that does not reach zero at the endpoints.
The window is defined by sampling the continuous function:
1 - abs(2x)
in the range [-0.5, 0.5]
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.gaussian
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▗▄▞▀▀▀▀▀▀▀▄▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▘ ▝▄ │
│ ▗▞ ▚▖ │
│ ▄▘ ▝▙ │
│ ▗▞ ▀▖ │
│ ▟▘ ▝▚ │
│ ▞▀ ▀▚ │
│ ▄▀ ▀▄ │
│ ▄▀ ▀▄ │
│ ▄▀ ▀▄ │
│ ▄▞▀ ▀▚▄ │
│ ▗▄▄▀▀ ▀▀▄▄▖ │
0 │▀▀▘ ▝▀▀│
└──────────────────────────────────────────────────────────────────────┘
1 69
gaussian(n::Integer, σ::Real; padding::Integer=0, zerophase::Bool=false)
gaussian(dims, σ; padding=0, zerophase=false)
Gives an n-sample gaussian window defined by sampling the function:
⎛ 2⎞
⎜-1 ⎛x⎞ ⎟
⎜── ⋅ ⎜─⎟ ⎟
⎝ 2 ⎝σ⎠ ⎠
w(x) = e
in the range [-0.5,0.5]
. This means that for σ=0.5
the endpoints of the window will correspond to 1 standard deviation away from the center.
Providing a dims
Tuple
rather than a single n
constructs a 2D window. σ
, padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.bartlett_hann
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▄▄▀▀▀▀▀▀▄▄ │
│ ▗▟▀ ▀▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▞▘ ▝▚ │
│ ▄▀ ▀▄ │
│ ▗▞ ▚▖ │
│ ▗▄▘ ▝▚▖ │
│ ▞▘ ▝▚ │
│ ▄▀ ▀▄ │
│ ▗▞ ▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▞▘ ▝▜▄ │
0 │▄▄▄▀▀ ▀▀▄▄▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
bartlett_hann(n::Integer; padding::Integer=0, zerophase::Bool=false)
bartlett_hann(dims; padding=0, zerophase=false)
Bartlett-Hann window of length n
with padding
zeros. The Bartlett-Hann window is a weighted sum of the Bartlett and Hann windows.
The window is defined by sampling the continuous function:
w(x) = 0.62 - 0.48*abs(x) + 0.38*cos(2π*x)
in the range [-0.5, 0.5]
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.blackman
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▗▞▀▀▀▀▀▀▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▞▘ ▝▚ │
│ ▗▀ ▀▖ │
│ ▄▘ ▝▙ │
│ ▞ ▚ │
│ ▗▀ ▀▖ │
│ ▗▘ ▝▖ │
│ ▞▘ ▝▚ │
│ ▄▞ ▚▄ │
│ ▗▞ ▚▖ │
│ ▞▘ ▝▚ │
│ ▗▄▀ ▀▄▖ │
│ ▄▞▘ ▝▚▄▖ │
0 │▄▄▄▄▄▄▞▀▀ ▝▀▚▄▄▄▄▄▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
blackman(n::Integer; padding::Integer=0, zerophase::Bool=false)
blackman(dims; padding=0, zerophase=false)
Approximates the "Exact" Blackman window. This is the generalized Blackman window with α = 0.16.
The window is defined by sampling the continuous function:
w(x) = 0.42 + 0.5*cos(2π*x) + 0.08*cos(4π*x)
in the range [-0.5, 0.5]
Providing a dims
Tuple
rather than a single n
constructs a 2D window. padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.kaiser
— Function ┌──────────────────────────────────────────────────────────────────────┐
1 │ ▗▄▀▀▀▀▀▀▄▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▘ ▝▄ │
│ ▞ ▚ │
│ ▗▀ ▀▖ │
│ ▗▘ ▝▖ │
│ ▄▘ ▝▄ │
│ ▞ ▚ │
│ ▗▞ ▚▖ │
│ ▗▘ ▝▖ │
│ ▗▀▘ ▝▀▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▄▞▘ ▝▚▄▖ │
0 │▄▄▄▄▄▄▄▞▀▘ ▝▀▚▄▄▄▄▄▄▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
kaiser(n::Integer, α::Real; padding::Integer=0, zerophase::Bool=false)
kaiser(dims, α; padding=0, zerophase=false)
Kaiser window of length n
parameterized by α
. The Kaiser window approximates the DPSS window (given by dpss
), using a simplified definition relying on a Bessel function. Larger values for α
give a wider main lobe but have lower sidelobes. Typically α
is set around 3.
The window is defined by sampling the continuous function:
⎛ ⎛ _________⎞⎞
⎜ ⎜ ╱ 2⎟⎟
w(x) = I₀⎝πα⎝╲╱ 1 - (2x) ⎠⎠
────────────────────
I₀(πα)
in the range [-0.5, 0.5]
Where I₀(⋅) is the zeroth-order modified Bessel function of the first kind.
Providing a dims
Tuple
rather than a single n
constructs a 2D window. α
, padding
and zerophase
can then be given either as a single value for both horizontal and vertical or a 2-tuple to specify them separately.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.dpss
— Function ┌──────────────────────────────────────────────────────────────────────┐
0.2 │ ▗▄▞▀▀▀▀▀▀▚▄▖ │
│ ▄▀▘ ▝▀▄ │
│ ▄▀ ▀▄ │
│ ▗▞ ▀▖ │
│ ▞▘ ▝▚ │
│ ▗▀ ▀▄ │
│ ▗▞▘ ▚▖ │
│ ▗▄▀ ▝▄▖ │
│ ▄▘ ▝▄ │
│ ▗▞ ▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▗▞▘ ▝▚▖ │
│ ▄▞▘ ▝▚▄ │
│ ▄▄▀▘ ▀▚▄ │
0 │▄▞▀▀ ▀▀▚▄│
└──────────────────────────────────────────────────────────────────────┘
1 69
dpss(n::Integer, nw::Real, ntapers::Integer=iceil(2*nw)-1;
padding::Integer=0, zerophase::Bool=false)
The first ntapers
discrete prolate spheroid sequences (Slepian tapers) as an n
× ntapers
matrix. The signs of the tapers follow the convention that the first element of the skew-symmetric (odd) tapers is positive. The time-bandwidth product is given by nw
.
The DPSS window maximizes the energy concentration in the main lobe.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
DSP.Windows.dpsseig
— Functiondpsseig(A, nw)
Eigenvalues of the DPSS matrix, representing the ratios of the power within the main lobe to the total power (main and sidelobes). A
is the output of dpss
, and nw
is the time-bandwidth product provided to dpss
as input.