2

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?

rclocher3
  • 9,112
  • 3
  • 20
  • 49
KevinHJ
  • 215
  • 1
  • 4

1 Answers1

5

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.

Phil Frost - W8II
  • 51,321
  • 5
  • 84
  • 209
  • Wow, thanks Phil for the very comprehensive answer. I see the point of what you're describing, but I'll have to chew on it awhile for it to feel intuitive to me. – KevinHJ Dec 02 '20 at 15:08
  • " - This is what the signal generator block outputs." This is what I am having troubling grappling with. The statement seems to imply that there is a single output which incorporates this function. Like a physical analog generator with one output whose signal follows a pattern which would describe the function. But if I pipe the generator block to a time domain block (oscilloscope) it shows 2 traces (I and Q) as though there were 2 inputs driven by 2 separate generators, one 90º out of phase with the other. – KevinHJ Dec 04 '20 at 20:15
  • 1
    @Allasso The output is a single number, but it's a [complex number](https://en.wikipedia.org/wiki/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: https://commons.wikimedia.org/wiki/Category:Euler%27s_formula_as_a_helix#/media/File:Rising_circular.gif – Phil Frost - W8II Dec 04 '20 at 21:50
  • 1
    @Allasso other visuals that may be helpful: https://commons.wikimedia.org/wiki/Category:Euler%27s_formula_as_a_helix – Phil Frost - W8II Dec 04 '20 at 21:52
  • 1
    @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. – Phil Frost - W8II Dec 04 '20 at 21:59
  • Do you think this explanation harmonizes with the math you've demonstrated? https://www.rtl-sdr.com/forum/viewtopic.php?f=1&t=6216#p16094 – KevinHJ Dec 08 '20 at 16:53
  • 1
    @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. – Phil Frost - W8II Dec 08 '20 at 19:43
  • Thanks very much for your helpful replies, Phil. I much appreciated the 3-D helix animations which help. I can see (or so it appears) how as you shift the phase difference between the two waveforms toward 0º or 180º, the helix would "flatten out" into a plane 45º. A similar effect happens if you don't change the phase difference, but lower the amplitude of one toward 0. Yet, while I can follow the math, and in accepting the definitions and theorems I can agree the math is correct, I'm yet to be able to _visualize_ the multiplication in the complex realm :-/ – KevinHJ Dec 09 '20 at 20:09
  • Much of this all stems from my trying to understand/visualize how, in an SDR, you can heterodyne a single input with a given frequency with the same LO frequency using with two mixers, one 90º from the other, and from the Q mixer, are able to capture the information on the lower sideband (eg, negative frequencies.) I'm sure that Euler's formula will explain that, but I have a hard time _visualizing_ how it can be so. – KevinHJ Dec 09 '20 at 20:21
  • 1
    @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. – Phil Frost - W8II Dec 09 '20 at 20:31
  • Thanks, I was wondering if that might be appropriate. I'll put a little time into trying to formulate my question comprehensively. – KevinHJ Dec 09 '20 at 20:35
  • I posted my question: https://ham.stackexchange.com/questions/17705/understanding-how-quadrature-heterodyning-captures-information-from-negative-fre – KevinHJ Dec 09 '20 at 21:46