Blackman (Blackman window): It is formed by using a conical front three summed cosine term. It is designed to have minimum leakage as close as possible. It is close to the best, just short window than Kaiser (Kaiser window).
Parameters (numpy.blackman):
M: int Points Output window.
If zero or less, or an empty array.
return value:
out: Array
Normalized to the maximum value of the window 1 (when the number of samples only when the display 1 is an odd number).
Example:
import numpy as np
print(np.blackman(12))
Output:
[ -1.38777878e-17 3.26064346e-02 1.59903635e-01 4.14397981e-01
7.36045180e-01 9.67046769e-01 9.67046769e-01 7.36045180e-01
4.14397981e-01 1.59903635e-01 3.26064346e-02 -1.38777878e-17]
Draw a window and the frequency response (and need SciPy matplotlib):
Code: For window:
import numpy as np
import matplotlib.pyplot as plt
from numpy.fft import fft, fftshift
window = np.blackman(51)
plt.plot(window)
plt.title("www.linuxidc.com")
plt.ylabel("Amplitude")
plt.xlabel("Sample")
plt.show()
Output:
Code: For frequencies:
import numpy as np
import matplotlib.pyplot as plt
from numpy.fft import fft, fftshift
window = np.blackman(51)
plt.figure()
A = fft(window, 2048) / 25.5
mag = np.abs(fftshift(A))
freq = np.linspace(-0.5, 0.5, len(A))
response = 20 * np.log10(mag)
response = np.clip(response, -100, 100)
plt.plot(freq, response)
plt.title("www.linuxidc.com")
plt.ylabel("Magnitude [dB]")
plt.xlabel("Normalized frequency [cycles per sample]")
plt.axis('tight')
plt.show()
Output: