I am generating an AM modulated sinusoidal wave. The carrier frequency is set at $1000 \ \rm Hz$; the modulation frequency is set to $40 \ \rm Hz$ and $100 \%$ of the amplitude is modulated.
I generated 2 signals with 2 slightly different equations.
- Signal 1 follows: $$\sin(2\pi f_m t) \cdot \sin(2\pi f_c t)$$
- while signal 2 follows: $$\big(1-\sin(2\pi f_m t)\big) \cdot \sin(2\pi f_c t)$$
I don't understand why the first signal doesn't have a $1 \ \rm kHz$ component on the FFT and why both signals do not have the same period.
Both $\sin(x)$ and $1-\sin(x)$ have the same period, and I can see that signal 1 has the amplitude sinus and the carrier sinus in phase, but I can't get my head around those plots and interprete them correctly. Thanks for all the information and explanation you can provide :)
Code snippet to produce the 2 signals:
#!/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')