carrier.py 文件源码

python
阅读 68 收藏 0 点赞 0 评论 0

项目:pactools 作者: pactools 项目源码 文件源码
def design(self, fs, fc, bandwidth, ripple_db=60.0):
        """
        Designs a FIR filter that is a low-pass filter.
        fs : sampling frequency (Hz)
        fc : cut-off frequency (Hz)
        bandwidth : transition bandwidth (Hz)s
        """
        # Compute the order and Kaiser parameter for the FIR filter.
        N, beta = signal.kaiserord(ripple_db, bandwidth / fs * 2)

        # Use firwin with a Kaiser window to create a lowpass FIR filter.
        fir = signal.firwin(N, fc / fs * 2, window=('kaiser', beta))

        # the filter must be symmetric, in order to be zero-phase
        assert np.all(np.abs(fir - fir[::-1]) < 1e-15)

        self.fir = fir / np.sum(fir)
        self.fs = fs
        return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号