24 lines
650 B
Python
Executable file
24 lines
650 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import numpy as np
|
|
from scipy import signal
|
|
from scipy.fft import fft, fftshift
|
|
import matplotlib.pyplot as plt
|
|
|
|
window = signal.windows.flattop(2500)
|
|
plt.plot(window)
|
|
plt.title("Flat top window")
|
|
plt.ylabel("Amplitude")
|
|
plt.xlabel("Sample")
|
|
|
|
plt.figure()
|
|
A = fft(window,65536) / (len(window)/2.0)
|
|
freq = np.linspace(-0.5*2500, 0.5*2500, len(A))
|
|
response = 20 * np.log10(np.abs(fftshift(A / abs(A).max())))
|
|
plt.plot(freq, response)
|
|
#plt.axis([-0.5, 0.5, -120, 0])
|
|
plt.title("Frequency response of the flat top window")
|
|
plt.ylabel("Normalized magnitude [dB]")
|
|
plt.xlabel("Normalized frequency [cycles per window]")
|
|
|
|
plt.show()
|