Engee documentation

blackman

Blackman’s window.

Library

EngeeDSP

Syntax

Function call

  • w = blackman(L) — returns L-point symmetric Blackman window.

  • w = blackman(L,sflag) — returns the Blackman window using the window selection specified by the argument sflag.

  • w = blackman(___,typeName) — indicates the possibility of returning the window w with single or double precision.

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.
Типы данных

Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

# 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", function blackman calculates the window length L + 1 and returns the first L points. 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.

Типы данных

String

# typeName — type of output data

+ Float64 (by default) | Float32

Details

The type of output data (class) specified in one of the following ways:

  • Float64 — use this value to return the output data. w with double precision.

  • Float32 — use this value to return the output data. w with single precision.

Типы данных

DataType

Output arguments

# w — Blackman’s window

+ column vector

Details

The Blackman window returned as a column vector.

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)

blackman 1

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)

blackman 2

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.

Literature

  1. Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999, pp. 468–471.