我正在生成一个 AM 调制正弦波。载波频率设置为;调制频率设置为和的幅度被调制。
我用 2 个稍微不同的方程生成了 2 个信号。
- 信号 1 如下:
- 而信号 2 如下:
我不明白为什么第一个信号在 FFT 上没有分量,为什么两个信号没有相同的周期。
\ sin和具有相同的周期,我可以看到信号 1 具有同相的幅度正弦和载波正弦,但我无法理解这些图并解释他们正确。感谢您提供的所有信息和解释:)
产生 2 个信号的代码片段:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from matplotlib import pyplot as plt
import numpy as np
import os
#%% Signal 1
fs = 44100 # sampling rate, Hz, must be integer
duration = 1.0 # in seconds, may be float
# Define the time series
t = np.linspace(0, duration, int(duration*fs), endpoint=False) # time variable
# AM - Amplitude Modulation
fm = 40 # Modulation frequency
amplitude = np.sin(2*np.pi*fm*t)
# Output signal
fc = 1000 # Carrier frequency
signal1 = amplitude * np.sin(2*np.pi*fc*t).astype(np.float32)
# Apply FFT
fft_freq1 = np.fft.rfftfreq(signal1.shape[0], 1.0/44100)
fft1 = np.abs(np.fft.rfft(signal1))
#%% Signal 2
fs = 44100 # sampling rate, Hz, must be integer
duration = 1.0 # in seconds, may be float
# Define the time series
t = np.linspace(0, duration, int(duration*fs), endpoint=False) # time variable
# AM - Amplitude Modulation
fm = 40 # Modulation frequency
amplitude = np.sin(2*np.pi*fm*t)
# Output signal
fc = 1000 # Carrier frequency
signal2 = (1-amplitude) * np.sin(2*np.pi*fc*t).astype(np.float32)
# Apply FFT
fft_freq2 = np.fft.rfftfreq(signal2.shape[0], 1.0/44100)
fft2 = np.abs(np.fft.rfft(signal2))
#%% Plot
f, ax = plt.subplots(2, 3, sharex=False)
ax[0, 0].plot(t[:4411], signal1[:4411])
ax[0, 0].set_title('Signal 1')
ax[1, 0].plot(t[:4411], signal2[:4411])
ax[1, 0].set_title('Signal 2')
ax[0, 2].plot(fft_freq1[900:1101], fft1[900:1101])
ax[0, 2].set_title('Signal 1 FFT')
ax[1, 2].plot(fft_freq2[900:1101], fft2[900:1101])
ax[1, 2].set_title('Signal 2 FFT')
ax[0, 1].plot(t[:4411], amplitude[:4411])
ax[0, 1].set_title('Signal 1 AM')
ax[1, 1].plot(t[:4411], (1-amplitude)[:4411])
ax[1, 1].set_title('Signal 2 AM')