def fir1(N, Wn):
# Variables definition :
nbands = len(Wn) + 1
ff = np.array((0, Wn[0], Wn[0], Wn[1], Wn[1], 1))
f0 = np.mean(ff[2:4])
L = N + 1
mags = np.array(range(nbands)) % 2
aa = np.ravel(repmat(mags, 2, 1), order='F')
# Get filter coefficients :
h = firls(L - 1, ff, aa)
# Apply a window to coefficients :
Wind = np.hamming(L)
b = np.matrix(h.T * Wind)
c = np.matrix(np.exp(-1j * 2 * np.pi * (f0 / 2) * np.array(range(L))))
b = b / abs(c * b.T)
return np.ndarray.squeeze(np.array(b)), 1
####################################################################
# - Filt the signal :
####################################################################
评论列表
文章目录