4
$\begingroup$

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 :)

signals

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')
$\endgroup$
1
  • 3
    $\begingroup$ simple trig identity:$sin(a) \cdot sin(b) = .5*[cos(a+b)-cos(a-b)]$ If you multiply two sine waves you get only the sum and difference frequencies. In this case the carrier disappears $\endgroup$ – Hilmar Nov 4 '20 at 12:48
3
$\begingroup$

There two definitions for the AM modulated signals

The first one is called as the classical-AM (or conventional AM) and is given by

$$x_{AM}(t) = (A_c + m(t)) \cdot \cos(2\pi f_c t) \tag{1}$$

and the second one is called as the DSB-SC (double side-band suppressed carrier) and is given by:

$$x_{AM}(t) = m(t) \cdot \cos(2\pi f_c t) \tag{2}$$

In your code, you use Eq.2 (DSB-SC) for the first example, and Eq.1 (classical AM) for the second example. Their difference is that the first one includes the carrier spectrum (the middle spike at $f_c$) at the output in addition to the modulating signal spectra (side-band spikes). The latter DSB-SC, however, only includes the modulating signal side-band spectra and not the carrier spectrum, hence the name suppressed carrier.

DSB-SC has the advantage that the tranmission energy is reduced as the permanently radiating carrier energy is saved yielding a more efficient transmission. Whereas the classical AM, which is less energy efficient to broadcast, has the advantage that its demodulation (by analog hardware) is extremely simple requiring what's known as the envelope detector (a diode, a capacitor and a resistance, in addition ot the antenna receiver and audio amplifier circuitry).

$\endgroup$
3
  • $\begingroup$ Could you add the equation for m(t)? Does it matter if I use sin or cos? Thanks for the answer, I will have a look at DSB-SC. $\endgroup$ – Mathieu Nov 4 '20 at 10:45
  • $\begingroup$ You can replace $m(t)$ with $\sin(2\pi f_m t)$ and it will be the same regardless of + or -, and sin or cos. The reason why you get twice zero crossing envelope with DSB-SC is that of the sign change of the multiplier $m(t)$, which always stays positive for classical AM by the addition of 1 to $m(t)$ (of course provided taht less than 100% modulation is used). If you increase the modulation percentage to far beyond 100% in classical AM, then you will also observe the same (similar) behaviour that of DSB-SC. $\endgroup$ – Fat32 Nov 4 '20 at 11:24
  • $\begingroup$ @Mathieu Also notice, that your amplitude modulation in the first signal has 0 DC component, while in the second signal the DC component = 1. $\endgroup$ – David Nov 6 '20 at 19:41
1
$\begingroup$

Time-domain multiplication of signals that are each a sum of only a few sinusoidal components is simple to understand as frequency-domain convolution:

enter image description here

showing first your signal 1:

$$\sin(2\pi f_m t) \cdot \sin(2\pi f_c t),$$

and then your signal 2:

$$\big(1-\sin(2\pi f_m t)\big) \cdot \sin(2\pi f_c t),$$

noting that $\cos(x) = \frac{1}{2}e^{-ix} + \frac{1}{2}e^{ix}$ splits each real sinusoid into a negative and a positive-frequency component.

I've only shown the component magnitudes in the illustrations. As none of the components coincide spectrally, the phases of the components do not matter, so you could as well have had say cosines instead of sines, and the plots would still be the same.

The frequency domain gives also a view to the periodicity properties of the signals. A periodic signal with fundamental period $P$ is also periodic with any period that is a multiple of $P$, so we should make a distinction between a period and the fundamental period when characterizing the signal. The fundamental period is the shortest period of a signal. A periodic signal with fundamental period $P$ can only consist of harmonic frequencies of the frequency that has exactly one cycle over the signal's fundamental period. That frequency is the reciprocal $1/P$ of the fundamental period. In other words, for a signal to be periodic, its Fourier transform must be zero-valued everywhere except for at multiples of the reciprocal of the fundamental period of the signal.

The tick marks in the following frequency-domain plots show the frequencies that are multiples of the reciprocal of the fundamental period. The tick-marks were arranged in the least-dense regular comb-like pattern that included frequency 0. The least-dense pattern was selected to catch the fundamental period rather than some longer period.

enter image description here

The tick mark patterns are different for the two signals, so the fundamental periods of your two signals differ.

However, the illustrations also show that both signals are periodic with a period that is the fundamental period of signal 2. The tick mark pattern of signal 2 captures also all frequencies present in signal 1.

A time-domain visual inspection confirms the findings (signal, and its fundamental period shown as a vertical line; blue: signal 1, red: signal 2):

enter image description here

$\endgroup$
4
  • $\begingroup$ These extra frequencies don't necessarily exist in the source physical process, which I presume was OP's main inquiry. $\endgroup$ – OverLordGoldDragon Nov 5 '20 at 16:07
  • $\begingroup$ Hmm why the downvote? $\endgroup$ – Olli Niemitalo Nov 6 '20 at 20:27
  • $\begingroup$ The downvote's not per disagreement with your verdict but due to pushing Fourier where it doesn't belong; the intuition that (at least could have) motivated this question is precisely the same as what motivated my amplitude aliasing question. It cannot explain the extra frequencies because they aren't there, any more than they are in the FT of a 1Hz pure triangular wave. $\endgroup$ – OverLordGoldDragon Nov 10 '20 at 22:24
  • $\begingroup$ Still this answer explains properly in at least one framework, and is more focused on the period question anyway. Downvote retracted (if you edit; SE won't let me), but I do 'relative voting', and I'd upvote had my answer not been below zero or yours been zero. $\endgroup$ – OverLordGoldDragon Nov 10 '20 at 22:25
-2
$\begingroup$

They do have a 1Khz component, but not via a Fourier lens.

To see what's happening, let's superimpose the AM signals with pure carrier tones:

enter image description here

Left plot reveals the key difference between the two AM schemes: polarity. Right is positive-only, left is zero-centered and flips signs. The effect of this sign reversal is, the "wiggling" of the carrier prematurely flips polarity. The red line shows when AM changes (+) to (-); without this sign reversal, we have a would-be positive peak at sample 32 (just as with blue pure tone) - with it, it's now negative.

This "fools" the Fourier decomposition into thinking that it's "more cycles", as that's what it would take to negative-peak sooner under a fixed-amplitude construction. The physical processes are still very much $f=2, 20$.

So the spectra we see are the result of having to represent the signal as a sum of fixed-amplitude frequencies. This Fourier construction is neither always the most meaningful, nor the most useful; I provide more intuition in this answer, and more on why FFT can mislead here and here; ignore the downvotes.


Caveat: if you count the orange peaks you won't find 40 in either case; each bears its own explanation given the AM. It may not be meaningful in the physical sense to decouple AM from carrier globally - e.g. consider what happens at right plot toward edges or right at center, where the AM is zero; an oscillation "skips", changing the "mean frequency" over the fundamental period. The left case shows more peaks, again per polarity flip. You can find more details here.

Further, you'll find slightly more cycles for orange even in the "well-behaved" region (away from AM zeros); it then may vary by purpose, but in an amplitude-decoupled framework this reflects as slightly higher carrier frequency, again more sensible than Fourier's. Lastly, arguably neither handle the case $f_m \rightarrow f_c$ too well in discerning what counts as "carrier" vs "modulator".


On sound: for predicting how we'd hear an AM waveform, a Fourier decomposition is indeed appropriate, as auditory processing is accurately modeled by fixed-amplitude sinusoidal decomposition (though not always), and the amplitude-decoupled decomposition won't apply.


Re: period there may be differences in fundamental periods $T$, but the two will still share a non-fundamental period. Put differently, the expected periodicity doesn't necessarily disappear, rather a smaller period is introduced due to AM to one of the signals and not the other. This is understood again from AM polarities.

Note I said "may"; my dummy example shows how the two can share the fundamental period, but this doesn't happen in OP's example. If there we set $f_m=100$, this is confirmed. Olli's answer fairly demonstrates how exact periodicity can be predicted from FT.

$\endgroup$
5
  • $\begingroup$ @OlliNiemitalo Downvote retracted even though I 'defy' Fourier? Now that's progress. -- Yeah I'm unsure disagreement's warranted with Fourier prediction on the period, will look into. $\endgroup$ – OverLordGoldDragon Nov 6 '20 at 17:23
  • $\begingroup$ Oh wait it's the frequencies (rather than polarities?) that are wrong here. $\endgroup$ – Olli Niemitalo Nov 6 '20 at 17:43
  • $\begingroup$ @OlliNiemitalo Guess this slipped your eye - indeed, it's Fourier-wrong. Can put back your downvote once I edit. $\endgroup$ – OverLordGoldDragon Nov 6 '20 at 21:48
  • $\begingroup$ I mean your signals are not the same as in the question $\endgroup$ – Olli Niemitalo Nov 7 '20 at 4:22
  • $\begingroup$ @OlliNiemitalo I see what you meant, addressed. $\endgroup$ – OverLordGoldDragon Nov 10 '20 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.