Вот функция Python, которая выполняет FM-демодуляцию на сложных выборках.
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 = sp.arange(len(x))
rx = x*sp.exp(-1j*2*sp.pi*fc*n)
# Extract phase of carrier.
phi = sp.arctan2(sp.imag(rx), sp.real(rx))
# Calculate frequency from phase.
y = sp.diff(sp.unwrap(phi)/(2*sp.pi*df))
return y