blackman
Blackman’s window.
| Library |
|
Arguments
Input arguments
# L — window length
+
a positive integer
Details
The window length, set as a positive integer.
If you ask L as a non-integer number, the function will round it to the nearest integer value.
|
| Типы данных |
|
# sflag — window selection
+
"symmetric" (by default) | "periodic"
Details
The window selection method, set as follows:
-
"symmetric"— use this value when using windows to design filters.; -
"periodic"— use this value when using windows for spectral analysis. When selecting a value"periodic", functionblackmancalculates the window lengthL + 1and returns the firstLpoints. The missing endpoint is the beginning of the next period of periodic expansion of the sequence. Therefore, the sequence satisfies the assumption of the periodicity of the discrete Fourier transform.
| Типы данных |
|
# typeName — type of output data
+
Float64 (by default) | Float32
Examples
Blackman’s Window
Details
Let’s create a Blackman window with 64 dots. Let’s display the result using plot.
import EngeeDSP.Functions: blackman
using Plots
L = 64
w = blackman(L)
plot(w,
title = "Time domain",
xlabel = "Samples",
ylabel = "Amplitude",
linewidth = 2,
color = :blue,
grid = true)
import EngeeDSP.Functions: blackman, fft, fftshift
using Plots
L = 64
w = blackman(L)
N_fft = 1024
window_fft = fft([w; zeros(N_fft - L)])
freq_response = 20 * log10.(abs.(fftshift(window_fft)) .+ eps())
freq_axis = range(-π, π, length=N_fft)
plot(freq_axis, freq_response,
title = "Frequency domain",
xlabel = "Normalized Frequency (×π rad/sample)",
ylabel = "Magnitude (dB)",
xlims = (0, π),
ylims = (-140, 40),
linewidth = 2,
color = :blue,
grid = true)
Algorithms
The following equation defines a Blackman window of length :
where equally When even, and When the odd one.
In the symmetric case, the second half of the Blackman window, , is obtained by reflecting the first half relative to the midpoint. The symmetric variant is the preferred method when using the Blackman window in the FIR filter.
The periodic Blackman window is constructed by extending the desired window length by one count to , constructing a symmetrical window and removing the last count. The periodic variant is the preferred method when using the Blackman window in spectral analysis, since the discrete Fourier transform involves periodic expansion of the input vector.