# Amplitude modulation and FFT query

I am generating a 0.5Hz sine wave, to which I'm adding a ramp envelope, to get a signal that ramps its amplitude from 0 - 10 - 0 Vpp. I then did an FFT (DFT? sorry not that up on the exact terminology here).

The frequency domain graph is how I expected except, the little peaks surrounding the peak at 0.5Hz. Is this a result of the computation (code below) or is this an actual phenomena associated with amplitude modulation, if so what is that? My code...

import numpy as np
from scipy import signal
from scipy.fft import fft, fftfreq
import matplotlib.pyplot as plt

f_sample  = 10000 # sample rate (44100 for output to wave file)
freq      = 0.5   # input frequency in Hertz
duration  = 200   # length of input in seconds

samples    = np.arange(duration * f_sample) / f_sample        # sample time steps
amp_scaler = len(samples) / 10                                # scale to 10Vpp
amp_1      = [i / amp_scaler for i in range(len(samples)//2)] # acending ramp
amp_2      = np.flip(amp_1)                                   # decending ramp
amp        = np.concatenate((amp_1, amp_2))                   # concated ramp
inp_sig    = amp * np.sin(2 * np.pi * freq * samples)         # input signal

# FFT
N      = len(inp_sig)
T      = 1 / f_sample
yf     = fft(inp_sig)
xf     = fftfreq(N, T)[:N//2]
yf_plt = 2.0/N * np.abs(yf[0:N//2])

figure, ax = plt.subplots(2)
figure.suptitle("Input: Sine wave, 0.5Hz, amplitude sweep 0 - 10 - 0 Vpp", fontsize=16)

ax.plot(samples, inp_sig)
ax.title.set_text('Time domain')
ax.set_xlabel('Seconds (s)')
ax.set_ylabel('Voltage (V)')

ax.plot(xf, yf_plt)
ax.title.set_text('Frequency domain')
ax.set_xlabel('Frequency (Hz)')
ax.set_ylabel('Voltage (V)')
ax.set_xlim(0, 1)
ax.set_xticks([0, 0.25, 0.5, 0.75, 1.0])

• AM & FM are nonstationary, for which time-frequency analysis is more appropriate. Oct 14, 2021 at 20:51

The math says: there has to be there ripples!

Thing is easy: A sine with a period that fits exactly an integer time into the DFT window (the FFT is just how you compute the DFT) will become a single dirac impulse through the DFT at both the positive and negative frequency.

If the resulting output was just a sharp line, it could be nothing but a harmonic signal - no envelope could have been applied! Any signal that's not just a simple harmonic oscillation needs to have a bandwidth, that's the idea (Pretty intuitive – without bandwidth, you can't modulate, and transport data. If you could, we could transport infinite amounts of data in no bandwidth.)

Now, you multiply that with sine a triangle. We know from the basics that multiplication in one domain is equal to convolution in the other for the DFT – so, the dirac-shaped spectrum gets convolved with the spectrum of a triangle. Convolution with a dirac is just shifting things around, so we should see the effect of shifting that triangle's spectrum to +- 0.5 Hz (which you won't see in your plot, because you're trying to fit 10000 Hz into maybe 1000 pixels... so, wrong visualization if you want to see the interesting parts.)

We happen to know how the spectrum of a triangle looks like: a triangle is the convolution (in time domain) of a square with a square, so in frequency domain it's the product of a square's spectrum with a square's spectrum. A square's spectrum is a sinc function, so a triangle's spectrum is a sinc².

This is a really classical problem that I've seen in multiple signal theory basics textbooks! Maybe you want to get one of these.

• Any recommendations for a decent signal theory basics textbooks? Oct 15, 2021 at 7:50
• I fare well with Oppenheim's Discrete Time Signal Processing, which is really cheap on used book websites. You might want to start with Signal and Systems by the same author! It's kind of a standard book, but I haven't read it. Oct 15, 2021 at 7:54