生成用余弦调制的正弦波

Generate sine wave modulated with a cosine

出于研究目的,我正在尝试重新创建以下内容(注意我是信号处理的新手):

A sleep spindle is defined by a sine wave which length is longer than 500 msec and whose frequency is within the band 12 to 14 Hz. The sleep spindle template was therefore defined by a 13 Hz sine wave modulated with a cosine (in which the 1/2 period is the length of the template). The length of the template was set to 1 second. This defines a band-pass filter centred on 13 Hz.

引文:Poiseau, E. & Jobert, M. (1991)。 应用于睡眠脑电图纺锤波和 k 复合波检测的匹配滤波。 http://documents.irevues.inist.fr/bitstream/handle/2042/11699/AR2_30.pdf?...1

上述论文的图 1 显示了它应该是什么样子的示例。我已经包含了下图的剪切图: Sleep Spindle

这是我目前拥有的一些代码。这只是创建正弦波:

import numpy as np
import matplotlib.pyplot as plt

def sleep_spindle_match(sampling_freq):
    freq = 13 #Hz

    x = np.arange(0,1,1.0/sampling_freq)
    sine = np.sin(2 * np.pi * freq * x + (np.pi/2))

    spindle = {'x':x, 'sine':sine}

    return spindle



x = sleep_spindle_match(44100)
plt.plot(x['x'], x['sine'])
plt.show()

但是,我不知道 "modulated with a cosine" 的含义或如何实现它。非常感谢任何用半拉门术语解释这一点的帮助。

我的最终目标(除此之外)是创建一个以上述为模板的匹配过滤器。不过那完全是另外一回事了。

他们说的是(振幅)modulation。调制是高频信号发生低频(缓慢)变化的过程。前者称为information signal,后者称为carrier signal.

看你的图片很明显,他们希望高频正弦波的振幅由余弦波调制(随时间缓慢变化)。

因此,调制信号将只是一个幅度为余弦函数的正弦波:

def get_signal_func(carrier_freq, carrier_phase0, signal_freq, signal_phase0):
    def signal(x):
        amplitude = math.cos(signal_freq*x + signal_phase0)
        return apmlitude * math.sin(carrier_freq*x + carrier_phase0)
    return signal

可能这就是 numpy 中的样子(示例):

signal = np.cos(freq*x + (np.pi/2)) * np.sin(100*freq*x + (np.pi/2))

请注意,正弦频率是余弦频率的 100 倍 - 载波通常具有更高的频率,因为如果载波和调制器具有相似的频率,接收器将很难重建信息(余弦波在你的情况)。

我的读数是,给定 1s x 轴,13Hz 正弦波按 0.5Hz 余弦波缩放。只需将样本相乘即可。

import numpy as np
import matplotlib.pyplot as plt

def sleep_spindle_match(sampling_freq):
    freq = 13 #Hz

    x = np.arange(0,1,1.0/sampling_freq)
    y = np.sin(2 * np.pi * freq * x + (np.pi/2)) * np.cos(np.pi * x + (np.pi/2))

    spindle = {'x':x, 'y':y}

    return spindle



x = sleep_spindle_match(44100)
plt.plot(x['x'], x['y'])
plt.show()