예제 #1
0
 def test_basic(self):
     assert_allclose(signal.bohman(6),
                     [0, 0.1791238937062839, 0.8343114522576858,
                      0.8343114522576858, 0.1791238937062838, 0])
     assert_allclose(signal.bohman(7, sym=True),
                     [0, 0.1089977810442293, 0.6089977810442293, 1.0,
                      0.6089977810442295, 0.1089977810442293, 0])
     assert_allclose(signal.bohman(6, False),
                     [0, 0.1089977810442293, 0.6089977810442293, 1.0,
                      0.6089977810442295, 0.1089977810442293])
예제 #2
0
 def test_basic(self):
     assert_allclose(signal.bohman(6),
                     [0, 0.1791238937062839, 0.8343114522576858,
                      0.8343114522576858, 0.1791238937062838, 0])
     assert_allclose(signal.bohman(7, sym=True),
                     [0, 0.1089977810442293, 0.6089977810442293, 1.0,
                      0.6089977810442295, 0.1089977810442293, 0])
     assert_allclose(signal.bohman(6, False),
                     [0, 0.1089977810442293, 0.6089977810442293, 1.0,
                      0.6089977810442295, 0.1089977810442293])
예제 #3
0
# Plot the window and its frequency response:

from scipy import signal
from scipy.fftpack import fft, fftshift
import matplotlib.pyplot as plt

window = signal.bohman(51)
plt.plot(window)
plt.title("Bohman window")
plt.ylabel("Amplitude")
plt.xlabel("Sample")

plt.figure()
A = fft(window, 2048) / (len(window)/2.0)
freq = np.linspace(-0.5, 0.5, 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 Bohman window")
plt.ylabel("Normalized magnitude [dB]")
plt.xlabel("Normalized frequency [cycles per sample]")