我正在使用Python的scipy.signal.remez函数设计等波纹高通滤波器。然而,结果的传输函数看起来对我来说非常奇怪,在通带中具有约15 dB的峰值,只有6 dB的阻带衰减。相应的低通滤波器设计看起来还不错(通带波动约为0.1 dB,阻带衰减约为40 dB):
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# Minimum working example for remez (equiripple) filter designs:
from __future__ import division, print_function
import numpy as np
import scipy.signal as sig
import matplotlib.pyplot as plt
F_PB = 0.1 # corner frequency of pass band
F_SB = 0.15 # corner frequency of stop band
W_PB = 1 # weight factor for pass band
W_SB = 1 # weight factor for stop band
L = 40 # filter order
#b = sig.remez(L, [0, F_PB, F_SB, 0.5], [1, 0], [W_PB, W_SB], Hz = 1) # low pass
b = sig.remez(L, [0, F_PB, F_SB, 0.5], [0, 1], [W_PB, W_SB], Hz = 1) # high pass
# Calculate H(w), w = 0 ... pi, 1024 Pts.
[w, H] = sig.freqz(b, worN = 1024)
# Translate w to normalized frequencies F = 0 ... 0.5:
F = w / (2 * np.pi)
plt.figure(1)
plt.plot(F, 20 * np.log10(abs(H)))
plt.title(r'Magnitude transfer function in dB')
plt.show()
有人能向我解释一下发生了什么吗?
谢谢,Christian