# Re: [linrad] DSP Question

```Alberto,

Thanks for all the valuable information. I think I'm beginning to
understand.

I now understand the reasoning for the half complex mixer and how it keeps
USB and LSB separated. At least I understand it in the context of continuous
samples. I have a question about how this behaves with discreted sampled
signals.

In my case, the IF that I am sampling is at12 kHz. Since this is a real
signal the frequencies range from 0 on up. I'm sampling the signal at 48 kHz
which means that the highest frequency I can deal with is 24 kHz. Anything
over 24 kHz will alias back into the -24 to +24 kHz range. I don't know the
details of the actual hardware (Pegasus for the IF and a computer soundcard
for the sampling), but for now, I will assume that anything beyond 24 kHz
has been removed through an analog filter.

So now, I have these samples that represent 0 to 24 kHz, and a mirror image
at -24 kHz to 0.  I digitally mix this with a complex 12 kHz signal.  This
shifts everything  up by 12 kHz so, if I understand it the signal that was
at -12 kHz is now at 0 Hz, the signal that was at 12 kHz is now at 24 kHz.
My question is what happened to the signal that was at 18 kHz. Adding 12 kHz
to it puts it at 30 kHz out of the range of my samples.  Also since there
was no input signal at - 30 kHz what is now at -18 kHz?  I realize that the
original 18 kHz signal had a mirror image at -18 kHz that is now shifted up
to -6 kHz.

One possiblity I see is that the 18 kHz signal could now wrapped around
to -18 kHz. The other possibility is that the 18 kHz signal that is shifted
up is lost (not completely as it's -18 kHz partner is now present at - 6
kHz) and that since there was nothing at -30 kHz before the mixing there is
now nothing at -18 kHz.

The reason I ask this is that the Pegasus RF hardware tunes the IF in 2.5
kHz steps and in the Pegaus DSP, the final 2.5 kHz is fine tuned (+/- 1.25
kHz) by the DSP.  Thanks to your description, I've successfully decoded USB
and LSB signals that were not on a 2.5 kHz boundary by using a mixing with a
complex signal whose frequency varied from 10.75 kHz to 13.25 kHz  (12 kHz
+/- 1.25 kHz).

However, generating a 12 kHz complex signal for a 48 kHz sample rate was
very simple and precise. Since 12 kHz is exactly 1/4 of the sample rate, all
the sin and cos terms became -1, 0 or +1.  This wasn't the case with the
10.75 or 13.25 kHz rates.

I'm wondering if (or how) I can simply mix with the 12 kHz signal, do a
complex FFT on the resulting I and Q signals and then somehow "rotate" the
FFT bins to bring the desired signal to 0 Hz?  Then could I apply your
technique below of taking the complex conjugate of the signals near zero and
mirroring them to the opposite end (24 kHz)?

Thanks again for your help and 73,
Mark

---------------------------------------

> Let's make an example for a direct conversion Rx :
>
> Carrier at 7 MHz,   LO at 7 MHz, both real signals, which means carrier
> at +7 and -7 MHz,
> Lo at +7 and -7 MHz.  Now multiply them together. The result is a
> combination of the 4 frequencies :
> (+7) + (+7) = +14 MHz
> (+7) + (-7)  =  0 MHz
> (-7) + (+7)  =  0 MHz
> (-7) + (-7)  = -14 MHz
> The 14 MHz are easily filtered away with a low pass filter, but the DC
> component is nasty, because
> you have the original LSB and USB of the 7 MHz carrier irremediably
> mixed together, as the zero IF
> is composed of the original +7 MHz signal pushed down to zero, having
> thus its USB going from
> zero to let's say 3 kHz, and the LSB going from zero to -3 kHz, _AND_
> the -7 MHz component
> pushed up to zero, with the LSB going from zero to +3 kHz, and the USB
> going from zero to -3 kHz.
> At this point there is on this earth no way to separate USB from LSB.
>
> Now keep the carrier at 7 MHz as a real signal, but make the LO an
> analytic signal, with just the positive
> component. For this, you need to have the LO described by I and Q. What
> happens now ?
> (+7) + (+7) = 14 MHz
> (-7) + (+7) = 0 MHz
> The component at zero IF isn't anymore the composition of two different
> signals, LSB and USB keep
> their identities separate. In this example, you will have the LSB from
> zero to +3 kHz, and the USB
> from zero to -3 kHz. They can now be individually selected, which can be
> called, with a loose term,
> "demodulation". Leif is right in saying that it is not a true
> demodulation, as it is not an information
> superimposed on a carrier, but let's use the word conventionally.
>
> Of course, as the resulting 14  MHz and 0 MHz signals do lack their
> respective negative components,
> they also are analytic signals, which means they must be described by I
> and Q.
>
> Hope you are still with me ...:-) But if you sketch all this on paper,
> it is much more intuitive.
>
> >Do I need to do this bandpass filtering before I do the complex FFT
below,
> >or can I use filtering in the frequency domain? If I do filter it here,
> >should I decimate the sample to a lower sampling rate before doing the
FFT?
> >
> >
> The example above is of course for an hardware half-complex mixer, as 7
> MHz are intractable in
> software. Working at much lower frequencies, if you do a low pass
> filtering in the the time domain,
> before the FFT, then you can downsample, and perform the FFT at the
> reduced sample rate, with
>
> >I think I understand what you are saying, but let me make sure.  A graph
> >would be helpful, but I'll try and explain my understanding in words.
> >
> >Lets say that I do a 1024 point complex FFT and the (complex) bins are
> >numbered from 0 to 1023.  The contents of bins 0 to 511 represent the USB
> >signal and bins from 1023 to 512 represent the LSB.
> >
> >To receive USB, I replace bin 1023 with the complex conjugate of bin 0,
bin
> >1022 with the CC of bin 1, 1021 with CC of bin 2 and so forth.
> >
> >To receive LSB, I replace bin 0 with the CC of bin 1023, 1 with the CC of
> >bin 1022, etc.
> >
> >
> Perfect ! You have grasped it exactly. It could be argued that may be
> there are other methods,
> more computationally efficient to recover  (notice : I didn't say
> 'demodulate' :-) the wanted audio,
> but that is what I consider the most mathematically "elegant"...  and in
> any case if you want to
> apply a bandpass or band reject filter, this is more easily done in the
> frequency domain.
>
> >Thanks for the info on your SDRadio.  I downloaded the program and it
looks
> >pretty impressive. Is the source code of at least the demodulation
> >available? A lot of time, I can understand an algorithm better if it's
> >expressed in code, even if it's not in a language that I use.
> >
> >
> The source code is not posted on a Web site, but I send it to those who
> ask for it. I will send
> it to you as attachment to a private message. The compiler used is the
> C++Builder V6 from Borland,
> and the sigproc package used is what you use as well, the Intel Signal
> Processing Library.
>
> 73  Alberto  I2PHD
>
>
>
```