Python:FM 解调实现

Fab*_*oli 1 python signal-processing modulation

我正在考虑分析一些特定值的时间序列,因为它是调频信号。

我正在寻找 FM 解调器的 Python 实现。我知道Matlab和Octave中有解调器功能;对于Python,我找到了这个FreqDemod包,但它似乎没有做我想做的事情。

帮助将不胜感激。

fst*_*_22 5

这是一个对复杂样本进行 FM 解调的 Python 函数。

import numpy as np

def fm_demod(x, df=1.0, fc=0.0):
    ''' Perform FM demodulation of complex carrier.

    Args:
        x (array):  FM modulated complex carrier.
        df (float): Normalized frequency deviation [Hz/V].
        fc (float): Normalized carrier frequency.

    Returns:
        Array of real modulating signal.
    '''

    # Remove carrier.
    n = np.arange(len(x))
    rx = x*np.exp(-1j*2*np.pi*fc*n)

    # Extract phase of carrier.
    phi = np.arctan2(np.imag(rx), np.real(rx))

    # Calculate frequency from phase.
    y = np.diff(np.unwrap(phi)/(2*np.pi*df))

    return y
Run Code Online (Sandbox Code Playgroud)