Converting a discrete real time domain to a discrete complex time domain signal

To test my understanding of amplitude modulation in the frequency domain I'm trying to replicate the center frequency with 2 side-bands in an Octave plot with the following code

t  = [ 0 : 1 : 4095];
Fs = 2500000;
Fc = 1000000;
Fsig = 100000;
carrier = 20*sin(2*pi*Fc/Fs*t)';
signal = 10*sin(2*pi*Fsig/Fs*t)';
modulated = carrier .* signal;

plot(abs(fft(modulated)))


And I'm getting the following plot

I suppose I'm getting the 2 peaks mirrored instead of a single central peak with 2 symmetrical side peaks because it's an FFT of a real signal and I need a complex signal instead.

How do I convert the real time-domain signal to a complex time-domain signal assuming the center frequency is Fc?

Edit:

To state the question more clearly.
How do I get an FFT which will have one peak at the center frequency and 2 side peaks (3 peaks total) from my AM signal above?

I understand that I'm getting what I'm getting because the AM signal is real.

So I suppose I need a complex time-domain signal to feed to fft instead.

Is it possible to convert my real AM signal to a complex signal somehow for the FFT of the complex signal to look similar to the below (photoshopped)?

I suppose that's what quadrature sampling does in a receiver, but how do I do this in the digital domain?

• what you get is correct; then probably your understanding is not... ? what were you expecting ? – Fat32 Dec 28 '19 at 0:22
• @Fat32, my bad in not formulating the question clearly. – axk Dec 28 '19 at 10:19
• Yes... I also understood that you wanted to simulate a classical AM instead of suppressed carrier DSB-SC... very bad formulation indeed :-) – Fat32 Dec 28 '19 at 15:52

My updated answer to OP's update

To do this specifically for the case of the FFT of a product of two sinusoids, you must choose a sampling rate or modulation frequency such that the upper sideband of the "positive" frequency component aliases to be on top of the lower sideband of the "negative" frequency component. For instance using a carrier frequency of 1.2MHz and a signal frequency of 50KHz would give you one peak in the center with two sidepeaks. (Although to note with 4095 points this wouldn't match the plot position since the center bin would be 2047 which is closer to where the lower sideband is in the plot).

Otherwise for an arbitrary signal the fft of the following would provide this result:

$$s[n] = Ae^{j\omega_c n}B\cos(\omega_m n)$$

Where

$$\omega_c$$ is the normalized radian frequency of the carrier ($$0$$ to $$2\pi$$)

$$\omega_n$$ is the normalized radian frequency of the modulation ($$0$$ to $$2\pi$$)

$$A$$, $$B$$ are arbitrary gain constants for each term (which simply scales the result by $$AB$$)

The opening part of the question was you are doing this to enhance your understanding of the frequency domain of AM modulation. So I am assuming you really want help understanding what AM modulation is supposed to look like:

When you multiply two sinusoids to get AM modulation, the result is DSB-SC (Double Side-band Suppressed Carrier): The carrier frequency is suppressed and there will only be two sidebands. This is what a cosine wave looks like in the FFT: two sidebands centered on the DC bin (use fftshift command if you want to center DC in the middle of the plot, then showing a positive and negative frequency axis which may help intuition), but since there is no DC in the cosine, that bin is supressed. So a cosine on its own is a DSB-SC signal with the carrier being DC, which is suppressed (we call that the baseband signal). If you multiply this baseband signal with a exponential carrier $$e^{j\omega_c n}$$ as I did above, this causes the frequency to shift by $$+\omega_c$$ , moving what was centered at DC to now be centered at $$\omega_c$$. If you muiltiply the baseband signal with a sinusoid, you shift in two directions (moving the signal to the positive and negative frequency carrier) since a sinusoid contains two exponential frequencies as further explained below.

What you show in the lower plot is Large Carrier AM, and specifically such a plot could be created from adding a DC offset prior to doing the upconversion:

$$s[n] = (C + A e^{j\omega_c n})B \cos(\omega_m n)$$

Converting the real signal from your product to a complex signal can of course be done, but the result of this would be the expected two sidebands only that you now have in either the positive frequency axis or negative frequency axis. This is the Hilbert Transform that will convert your real signal that has complex conjugate symmetric positive and negative frequencies to a complex signal that only has positive or negative frequencies depending on the sign of Q.

My earlier answer regarding why the upper and lower sidebands are not equal magnitude in the FFT result

Either window your time domain data before taking the FFT or increase the length of your time domain data (and therefore your FFT). You are seeing the effects of “scalloping loss” which occurs when the actual frequency terms are not an bin centers. Zero padding your time domain data before taking the FFT will also help to make the result look closer to what you would expect since that will interpolate more samples in the frequency domain resulting in balanced sum and difference frequency magnitudes.

Also the command fftshift() will move “DC” to the center of the axis to give you a plot with positive and negative frequencies which may be more intuitive. Keep in mind that a real signal will have positive and negative frequency components in the FFT result since each bin represents an exponential frequency term $$e^{j\omega t}$$, and as is clear in Euler's identity, a sinusoidal term is composed on two exponential frequency terms. For example:

$$2\cos(\omega t) = e^{j\omega t}+ e^{-j\omega t}$$

Your time domain repesentation would be a sine wave at 900 KHz and 1.1 MHz, so the result if you increase the time domain length by adding more samples or zero-padding will approximate the expected result showing two equally weighted frequency impulses in the positive frequency axis at 900 KHz and 1.1 MHz as well as two frequency impulses in the negative frequency axis at -900 KHz and -1.1 MHz.

• Please see my edit, sorry for the confusion. I understand why I'm not getting perfect impulses and that I'm getting the mirrored versions of the 2 frequencies because I feeding a real signal to fft. The question is how do I convert this real signal to a complex one before feeding it to fft so that I see one central peak with 2 symmetrical side peaks on the FFT. – axk Dec 28 '19 at 10:25
• So my first plot is showing 2 "copies" of the same DSB-SC baseband signal frequency-shifted in opposite directions? If so then I would expect them to be all the same amplitude (as on the FFT of the baseband DSB-SC) on the FFT, but they are not. Is this “scalloping loss”? – axk Dec 28 '19 at 15:25
• Yes that is what I explained in detail in my first answer, including what you can do specifically to make them equal amplitudes. – Dan Boschen Dec 28 '19 at 15:32