My motivation to this post has arisen from the accepted answer to Amplitude modulation vs sampling rate?

Sampling the signal with the frequency close to $f_s/2$ can lead to some kind of "beatings" of the sampled signal. It is clearly seen if I try to sample simple cosine signal: enter image description here

Here FFT shows both positive and negative frequencies of the signal as it should be.

But if I try complex signal (here it is $e^{j2\pi f t}$) and left plot is real part of my complex signal: enter image description here

In this case FFT shows only one (positive) frequency component, but beatings of the sampled signal still exist. My question is why?

The Python code to reproduce these plots:

fig, ax = plt.subplots(2,2, figsize=(15,5))

fs = 20
f = 8.8
t = np.arange(0, 2, 1/(fs*fs))
t_sampled = np.arange(0, 2, 1/fs)

signal_complex = np.exp(1j*(2*np.pi*f*t_sampled))
signal_real = np.cos(2*np.pi*f*t_sampled) # cosine

ax[0,0].plot(t, np.cos(2*np.pi*f*t))
ax[0,0].plot(t_sampled, signal_real, color='r', marker='o')
ax[0,0].set_title('Time domain (cosine signal)')

ax[1,0].plot(t, np.exp(1j*(2*np.pi*f*t)).real)
ax[1,0].plot(t_sampled, signal_complex, color='r', marker='o')
ax[1,0].set_title('Time domain (exponential signal)')

FFT_complex = np.fft.fft(signal_complex)
FFT_real = np.fft.fft(signal_real)
freqs_fft = np.fft.fftfreq(len(t_sampled), t_sampled[1])

ax[0,1].stem(freqs_fft, abs(FFT_real))
ax[0,1].set_title('FFT (cosine signal)')

ax[1,1].stem(freqs_fft, abs(FFT_complex))
ax[1,1].set_title('FFT (exponential signal)')

  • $\begingroup$ Plotting just the real part of a complex signal doesn't tell the whole story. Try plotting the amplitude of your complex signal, or the real and imaginary part together on the same graph. $\endgroup$
    – TimWescott
    Commented Sep 7, 2022 at 18:15
  • $\begingroup$ @TimWescott, I tried to plot real and imaginary parts and got the same result - beatings exactly at frequency $fs/2-f$, I also tried to plot the amplitude (module) and got just a straight line $\endgroup$
    – Curious
    Commented Sep 7, 2022 at 20:02
  • $\begingroup$ It's not unambiguously "there's no beats". Refer to this and this. Short version, if we know it'd bandlimited, then there's no beats. $\endgroup$ Commented Sep 7, 2022 at 21:30
  • $\begingroup$ @OverLordGoldDragon, I saw your question (first link) and after it asked my own here, I think bandlimited signal'll also look like a signal with beatings as we're close to $f_s/2$ $\endgroup$
    – Curious
    Commented Sep 7, 2022 at 21:45
  • $\begingroup$ More detail, if we know it's bandlimited and the signal of interest is analog, then the signal is a pure sine - that is, the samples perfectly and uniquely reconstruct to a pure sine. Disagreement can only occur if we're not bandlimited or if the discrete sequence is ground truth. Otherwise we're saying a pure sine has beats, which violates the definition. $\endgroup$ Commented Sep 7, 2022 at 23:35

2 Answers 2


Through the commentary I now understand the crux of the OP's question which I will summarize as follows:

As detailed in the referenced post (https://dsp.stackexchange.com/a/70884/21048) I was able to explain how the underlying analog signal prior to sampling could have either been a single real tone OR a double-side-band-suppressed-carrier (DSB-SC) modulation with the suppressed carrier at $f_s/2$ (and there are infinitely many other solutions that would result in the same discrete samples that resulted). The OP has astutely observed that the same result (the beats in the time domain) can occur even if the input isn't real, which seems to counter the explanation provided.

The reason is the time domain plot shown is just the real component. In doing that the spectrum of the real component alone is identical to the first spectrum shown above which is the spectrum of the real signal NOT the complex signal. To observe the complex time domain signal we must observe two real signals (either magnitude and phase or real and imaginary). From a plot of magnitude and phase of the complex case, it will be clear that the magnitude is constant at all time samples while the same plot of magnitude and phase for the real case will show the beating as observed. If we choose to instead plot real and imaginary, then yes each of those will show beating but it is in such a way to maintain a constant magnitude (as one goes up the other goes down). Beating refers to an Amplitude Modulation, and with the complex waveform as $I+jQ$ we must consider both $I$ and $Q$ together to measure the amplitude, not individually. So plotting amplitude as $\sqrt{I^2+Q^2}$ will show that there is no beating (no AM), unless we take the real or take the imaginary only of the resulting waveform.

Consider the simple case for the spectrum of $e^{j \omega_o t}$ as plotted below without the added complexity of sampling, folding and spectral leakage:

complex spectrum

$$e^{j \omega_o t} = \cos(\omega_o t) + j \sin (\omega_o t)$$

So if we were to only plot the real part of the above complex spectrum in the time domain, we would get $\cos(\omega_o t)$. However to be complete the spectrum of this would then appear as below:

real spectrum

So bottom line, the second time domain plot on the left showing beating together with a complex spectrum on the right is incomplete. The time domain plot is not the time domain for the spectrum given, but the time domain for the real portion of the spectrum given (which would then be identical to the spectrum in the upper plot).

  • $\begingroup$ but in both cases the envelope frequency of the sampled signal is $f_s/2-f$; following your answer I think it would help to remove "beatings" $\endgroup$
    – Curious
    Commented Sep 7, 2022 at 19:33
  • $\begingroup$ what do you mean by "two tones spaced apart in frequency by twice the beat tone frequency"? $\endgroup$
    – Curious
    Commented Sep 7, 2022 at 20:49
  • $\begingroup$ I'm familiar with AM-signals and understand what did you mean: $f_s/2$ - carrier, $f_s/2-f$ - lower sideband, $f_s/2+(f_s/2-f)$ - upper sideband, with this in mind I get the same plot (though I still didn't get, why $f_s/2$ is carrier in this case), but in your plot for complex tone the output spectrum has no component for $f_s/2+(f_s/2-f)$ (upper sideband), but $f_s/2-f$ beatings exist, that's why I've posted this question. $\endgroup$
    – Curious
    Commented Sep 10, 2022 at 20:46
  • 1
    $\begingroup$ @Curious The “beatings” as described are an AM artifact so result in the amplitude only. If you compare the magnitudes of the real vs the imaginary you will then properly confirm that the real has beats and the imaginary doesn’t (constant as it should be) $\endgroup$ Commented Sep 14, 2022 at 18:08
  • 1
    $\begingroup$ it obviously makes sense!) thinking in terms of sinusoids (in particular for this example) can really as you said before "misguide" the intuition and understanding the sampling process. $\endgroup$
    – Curious
    Commented Sep 15, 2022 at 17:50

In this case FFT shows only one (positive) frequency component, but beatings of the sampled signal still exist. My question is why?

Why would it? Real vs. complex has nothing to do with the phenomenon we are looking at. The only difference between a real and complex sinusoid is that the former has two spectral lines and the latter only one.

You seem to be confusing two different effects here.

The so-called "beating" does NOT exist. It's simply a visual artifact of the way you draw the waveform. Most plotting routines simply connect samples with straight lines which is simply wrong. If you were to draw this using proper band-limited interpolation at each pixel (and with enough pixels) you get the correct waveform. This has no bearing on the frequency domain at all.

The spreading of the spectrum you see is spectral leakage. There are plenty of post on this forum about this. Spectral leakage occurs for sine waves whose frequency doesn't line up with the frequency grid of the FFT. As long as your frequency is an integer multiple of the bin resolution (sample rate divided by FFT length), you will only get a single spectral line, regardless whether there "visual beating" or not in your time domain graph.

In your case, the frequency resolution is 0.5Hz so if you choose 8.5Hz or 8Hz (instead of 8.8Hz) all the spectral artifacts will disappear.

EDIT: Derivation of the apparent beat at $(f_s/2-f)$

Let's say we have a sequence $x[n] = \cos(\omega n)$. If $\omega$ is close to Nyquist we can write this $\omega = \pi-\delta$ where $\delta$ is the frequency difference to Nyquist.

Hence we get $$x[n] = \cos(\pi n - \delta n) = \cos(\pi n )\cos(\delta n) + \sin(\pi n )\sin(\delta n)$$

$\sin(\pi n ) = 0$ and $\cos(\pi n ) = [+1,-1,+1,-1,...] = (-1)^n$ so the whole thing becomes

$$x[n] = (-1)^n\cos(\delta n) = (-1)^n\cos(2\pi(f_s/2-f) n) $$

Note that we haven't done any actual manipulation here, we've just written the samples of the sine wave in a different form.

You visually interpret this as something that's oscillating fast multiplied with a slow sine wave. That sort of looks like a beat, but it's not. It's still a perfectly good sine wave. There is no actual amplitude modulation whatsoever.

  • $\begingroup$ ok, but how can be explained the fact that sampled signal has the envelope frequency of exactly $f_s/2-f$? $\endgroup$
    – Curious
    Commented Sep 7, 2022 at 19:36
  • 1
    $\begingroup$ See updated answer. I took a swing at explaining why it looks like $f_s/2-f$ $\endgroup$
    – Hilmar
    Commented Sep 7, 2022 at 21:53
  • 1
    $\begingroup$ Sorry, I didn't explain this well. Of course you can write $\omega = \pi-\delta$ for any frequency. However, if $\omega$ is close to Nyquist (which corresponds to $\pi$) than $\delta$ becomes very small and $\cos(\delta n)$ looks like a beat. $\endgroup$
    – Hilmar
    Commented Sep 10, 2022 at 18:32
  • 1
    $\begingroup$ $\pi$ is the normalized frequency of Nyquist. Let's sample $\cos(2\pi \frac{f_s}{2} t)$ at $f_s = 1/T_s$. We get $x[n] = \cos(2\pi \frac{f_s}{2} nT_s ) = \cos(2\pi \frac{f_s}{2} n/f_s) = \cos(\pi n)$ $\endgroup$
    – Hilmar
    Commented Sep 12, 2022 at 2:29
  • 1
    $\begingroup$ Yes. That's why often use $\omega = 2\pi f/f_s$ as the "normalized frequency". This is normalizes everything to the sample rate. For discrete signals, calling a frequency "high" or "low" is always with respect to the sample rate, regardless of whether it's $1Hz$ or $1GHz$ $\endgroup$
    – Hilmar
    Commented Sep 14, 2022 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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