我尝试使用 Hammond Window 实现低通滤波器。截止频率是 0.3,滤波器阶数是 21。我的问题是我有一条直线,它没有穿过表示的点。这是代码:
from pylab import *
import scipy.signal as signal
import matplotlib.pyplot as plt
#Plot step and impulse response
def impz(b,a=1):
l = len(b)
impulse = repeat(0.,l); impulse[0] =1.
x = arange(0,l)
response = signal.lfilter(b,a,impulse)
subplot(211)
stem(x, response)
ylabel('Amplitude')
xlabel(r'Index')
title(r'Impulse response')
n = 21
a = signal.firwin(n, cutoff = 0.3, window = "hamming")
#Impulse and step response
figure(2)
impz(a)
show()
为什么最后一张图中的红线没有穿过情节的点?任何想法为什么?谢谢!