2
$\begingroup$

I have been working at educating myself on how SDR and GNU Radio works.

In order to demonstrate heterodyning, I set up a flow-graph consisting of 2 signal generators, a Multiply block, and QT GUI Frequency Sink. The generators are connected to the Multiply block inputs, and the Multiply block output is connect to the Freq Sink, in order to heterodyne the two generator signals.

The frequency of the generators are linked to a slider. One generator is slider_value, the other is slider_value + 2000. The generators are both outputting a cosine waveform.

When setting all the inputs to float, as I move the slider I get the results I would expect:

I see one peak always at 2000 Hz: slider_value - slider_value + 2000 = 2000. Ie, the difference signal.

I see another peak at the sum of the generator outputs: slider_value + slider_value + 2000 = (2 * slider_value) + 2000.

However, if I switch all the inputs and outputs to complex, I only see one peak which is at the sum of the values. I do not see a peak at the difference, ie, nothing at 2000 (except when slider_value = 0).

Can someone explain to me why I don't see the difference signal when multiplying complex signals?

$\endgroup$
1
  • $\begingroup$ Hello and welcome to ham.stackexchange.com! $\endgroup$
    – rclocher3
    Dec 1, 2020 at 15:59

1 Answer 1

5
$\begingroup$

This is how the mathematics of complex signals work.

The proof begins with Euler's formula:

$$ e^{i\varphi} = \cos \varphi + i \sin \varphi \tag 1 $$

For signal processing, instead of $\varphi$, we are usually thinking about some sinusoidal oscillation at angular frequency $\omega$ that varies with time $t$, which we can write as:

$$ e^{i\omega t} \tag 2 $$

This is what the signal generator block outputs, when in sine mode and with a complex output. By (1) above you can see both the real and imaginary parts are sinusoids at angular frequency $\omega$, just offset 90 degrees in phase.

When you multiply two of these complex sinusoids together, at frequencies $\omega_1$ and $\omega_2$, you get:

$$ e^{i\omega_1 t} e^{i\omega_2 t} \tag 3 $$

which simplifies to

$$ e^{i (\omega_1 + \omega_2) t} \tag 4 $$

which, again by (1), is a single complex sinusoid at frequency $\omega_1 + \omega_2$. There is no difference term.

A consequence of this math is that $\omega$ can be negative. Which is why in GNU Radio if you have a complex stream at a sample rate of say 48 kHz, that can represent 96 kHz of bandwidth: from -48 kHz to 48 kHz.

The sum and difference terms when heterodyning real-valued functions comes about because a real function can not unambiguously represent positive and negative frequencies, but mathematically, they are still there.

How? Consider two complex sinusoids, at frequencies $\omega$ and $-\omega$, summed together:

$$ e^{i\omega t} + e^{-i\omega t} = \cos \omega t + i \sin \omega t + \cos -\omega t + i \sin -\omega t \tag 5 $$

Considering the trigonometric identities:

$$ \cos x = \cos −x \\ \sin x + \sin -x = 0 \tag 6 $$

Now (5) simplifies to:

$$ e^{i\omega t} + e^{-i\omega t} = 2\cos(\omega t) \tag 7 $$

Which means when you multiply two real sinusoids to heterodyne a signal:

$$ \cos \omega_1 t \times \cos \omega_2 t \tag 8 $$

Then by (7) and neglecting the factor of 2 (since it only changes the amplitude of the result, and that's not important), equivalently you're doing:

$$ (e^{i\omega_1 t} + e^{-i\omega_1 t}) (e^{i\omega_2 t} + e^{-i\omega_2 t}) \\ = (e^{-i(\omega_1-\omega_2)} + e^{i(\omega_1-\omega_2)}) + (e^{-i(\omega_1+\omega_2)} + e^{i(\omega_1+\omega_2)}) \tag 9 $$

Notice the difference of the frequencies on the left, and the sum on the right. Each group is comprised of positive and negative variations of the same frequency, which by (7) we know simplifies to just a real-valued sinusoid. So (9) further simplifies (again neglecting that factor of 2) to:

$$ \cos((\omega_1-\omega_2) t) + \cos((\omega_1+\omega_2) t) \tag {10} $$

And there you have your common real-valued function heterodyning equation.

Thus, any real-valued function has both positive and negative frequencies in it, but the negative frequencies are just a "mirror" of the positive ones. It's because of those negative frequencies that LSB demodulation can "flip" the spectrum, and it's the negative frequencies that cause the difference term when heterodyning real-valued functions.

$\endgroup$
12
  • 1
    $\begingroup$ @Allasso The output is a single number, but it's a complex number. But a complex number has two dimensions (the real and imaginary parts), so if you have a 2-dimensional oscilloscope and you want 1 of the dimensions to be time, you have to graph the real and imaginary parts separately. If you had a 3-dimensional oscilloscope, it would look like this: commons.wikimedia.org/wiki/… $\endgroup$ Dec 4, 2020 at 21:50
  • 1
    $\begingroup$ @Allasso other visuals that may be helpful: commons.wikimedia.org/wiki/… $\endgroup$ Dec 4, 2020 at 21:52
  • 1
    $\begingroup$ @Allasso You might also find the "constellation sink" helpful. Like the time sink this is a 2D visualization, but instead of making 1 of the dimensions time, it makes 1 dimension the real part, and the other the imaginary part. As you see in the visualizations above, $e^{i\omega t}$ makes a helix: the constellation sink and time sinks are showing the same thing, but showing you 2D projections of it on different planes. $\endgroup$ Dec 4, 2020 at 21:59
  • 1
    $\begingroup$ @Allasso Yes, that seems like a valid way to put it. If you replace the last term in equation 5 with its identity $-i \sin \omega t$, you can see $e^{i\omega t}$ and $e^{-i \omega t}$ are complex conjugates. Equation 7 shows those conjugate pairs cancelling the imaginary to leave a purely real part. $\endgroup$ Dec 8, 2020 at 19:43
  • 1
    $\begingroup$ @Allasso This is a bit much for comments, but if you want to ask a new question on that, I'd be happy to provide an answer. $\endgroup$ Dec 9, 2020 at 20:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .