14

To my understanding hardware receivers for software-defined radio applications basically take the input signal, mix it with the tuning frequency to remove the carrier frequency and then sample the resulting voltage with a sampling rate that is just high enough for the bandwidth of the payload signal. They emit those samples to the demodulation software in the form of I/Q value pairs. I'm assuming they obtain the Q value by taking another sample $1/4$ cycle (with respect to the tuning frequency) later, effectively doubling the sample rate.

Why do they use the I/Q representation?

I can see how I/Q is a nice representation (in hardware) when synthesizing signals because you can for example do frequency or phase modulation just by varying amplitudes, but this reason doesn't seem to apply to the case of SDR receivers.

So, is there anything gained by using I/Q for output instead of I at twice the sampling rate? Or is it just a matter of convention?

AndreKR
  • 243
  • 2
  • 5
  • @Gilles I rolled back your edit. It's really just one question phrased in multiple ways for clarity, styling them as an enumeration makes no sense to me. – AndreKR Feb 15 '17 at 11:06
  • 1
    I answered a similar question over here: http://electronics.stackexchange.com/questions/39796/can-somebody-explain-what-iq-quadrature-means-in-terms-of-sdr/99617#99617 – hotpaw2 Feb 15 '17 at 14:41

3 Answers3

7

The SDR (or any general digital signal processing system) receiver takes the received RF signal, and down-converts it from the carrier frequency to the baseband, converting a real bandpass signal to it’s equivalent complex baseband signal with I and Q samples as real and imaginary components (and the transmitter takes the I and Q baseband samples and up-converters them to a real passband signal).

The real bandpass signal from the antenna does not necessarily have a symmetric spectrum around the carrier frequency. If the downconverter translates the spectrum to baseband, the corresponding time-domain signal will necessarily be complex in order to maintain an asymmetric spectrum (recall a real waveform in time must have a complex conjugate symmetric spectrum in frequency). The I and Q samples you get from the SDR are typically the real and imaginary part of the complex baseband signal, that corresponds to your real passband signal around the carrier frequency.

More details can e.g. be found at the wikipedia site for digital down conversion.

To answer your question:

I/Q representation does not correspond to different sampling points of the signal. Instead, it corresponds to the real and imaginary part of the digital complex-valued baseband signal. These parts are obtained by separately multiplying the RF signal with a sine and a cosine and sampling both streams after low-pass filtering.

Sampling with double frequency can yield the same information as I/Q. It would be neccessary to homodyne the signal to $f_s/4$ to get all information that would have been in the baseband IQ signal to be in the passband signal at $f_s/4$ (where $f_s$ is the sampling rate).

Dan Boschen
  • 50,942
  • 2
  • 57
  • 135
Maximilian Matthé
  • 6,218
  • 2
  • 12
  • 19
  • Good answer. Just to clarify, I think you can yield the exact same information with sampling with a double frequency, if you allow the signal in IQ at baseband with sampling rate $F_s$ to exist at $F_s/2$ when sampling at $2F_s$ (in other words at 1/4 of the new sampling rate). Do you agree? – Dan Boschen Feb 15 '17 at 11:21
  • @DanBoschen I believe you do not get the same information when you sample with double frequency from just a single stream (e.g. the multiplied with a sine). This will still just yield a real-valued baseband signal with double sampling rate, which corresponds to the even part of the baseband spectrum. Still, the odd part (i.e. the imaginary baseband signal) is not available. – Maximilian Matthé Feb 15 '17 at 11:49
  • Consider that you can have the exact same spectrum at fs/4 that you can have at baseband (meaning the positive portion above fs/4 does not need to match the "negative" portion that in this case would be below fs/4). If you think about it, this is no different than having the real signal at the antenna (or carrier) representing the baseband IQ signal at DC. Although I haven't mathematically worked out the proof, but that is my thinking and recollection. – Dan Boschen Feb 15 '17 at 11:52
  • Consider this example: A complex signal at baseband that is in the band less than +/- Fs/2, sampled at 2Fs. It is complex and it's positive spectrum from DC to Fs/2 is not the same as its negative spectrum from -Fs/2 to DC (and therefore requires two real signals whether it be I and Q or Magnitude and Phase to represent it). Now rotate that spectrum by multiplying by $e^{jnw \pi/2}$. where n is the sample count. The result will have shifted the spectrum to + Fs/4, with no spectrum in the negative half, but no other changes. Now take the real part. – Dan Boschen Feb 15 '17 at 12:00
  • By taking the real part of the complex signal described above, a negative image will appear (Complex conjugate) and the the original signal will have scaled but is otherwise left unchanged. Apart from a scaling factor, the signal that was at fs/4 is identical to the baseband signal we started with; all the information is intact! (Just as when we move the signal to the carrier frequency which is also real). Do you see a flaw in my thinking? (I am also NOT implying using the "same" I as just twice the sampling rate, but meaning using just I which is a single real valued data stream). – Dan Boschen Feb 15 '17 at 12:04
  • @DanBoschen OK I see what you mean: Given a band-limited bandpass signal with bandwidth B (on each side of the carrier F). You shift this spectrum by F-B, such that the lowest frequency of the bandpass signal resides at f=0 in baseband and the spectrum in baseband ranges from 0...2B. Then you sample with 4B and only the I-path. This should also do the trick, but I believe the samples do not correspond to the IQ values you get from the standard procedure. – Maximilian Matthé Feb 15 '17 at 12:07
  • Yes the values themselves will not match of course until you "derotate" them back to 0, and if you want the signal to be centered at 0 you would then need I and Q samples again. Point is however besides the "carrier" being 0 or at fs/4 the information content is not corrupted in any way- the spectrum and the signal will be identical just center frequency shifted - agree? – Dan Boschen Feb 15 '17 at 12:28
  • Yes I agree, the information content should be the same. – Maximilian Matthé Feb 15 '17 at 12:35
  • Yes, @DanBoschen is correct. There are two common sampling methods used in SDR applications: with downconversion to complex baseband (as described in the OP) and real-valued samples at twice the sample rate, centered at some intermediate frequency (IF). $f_s/4$ is the most convenient IF to use, as it allows the same amount of frequency coverage as the complex case. However, it takes more complicated hardware and/or processing to derive the complex signal, whereas you can get the real-valued IF signal with a single ADC and no postprocessing. – Jason R Feb 15 '17 at 14:26
  • With that said, I always use complex when I can, as it's most mathematically convenient for many signal processing operations. It's easy to transform between a real-valued IF signal and complex-valued baseband signals in software, so either type of sampling can be used in the RF front end. Most high-performance receivers that I've seen actually generate real-valued samples; if they output complex-valued samples, they are generated by an internal digital downconverter. – Jason R Feb 15 '17 at 14:26
  • See my more detailed answer here, related to this: http://dsp.stackexchange.com/questions/14368/iq-sampling-vs-2x-f0-sampling-for-sdr/37640#37640 – Dan Boschen Feb 15 '17 at 14:40
  • ... and how simple digital Fs/4 downconversion can be (demultiplexing and multiplying by +/- 1's is very simple!). This most simple reduction assumes of course that carrier tracking is handled elsewhere, otherwise this Fa/4 rotator can be part of the carrier tracking loop (where a full complex rotator would be required). – Dan Boschen Feb 15 '17 at 14:47
  • IQ data can be generated either by sine/cosine mixing or by sampling with a phase offset. – hotpaw2 Feb 15 '17 at 17:00
  • @hotpaw2: We must caution readers that sampling with a phase offset is only an approximation which holds well when the signal bandwidth is significantly smaller than the sampling rate. Otherwise dispersion errors result as the resulting signal that was sampled "in quadrature" is only truly in quadrature at one frequency (a delay is a linear phase vs frequency, so this methods that creates a 90 degree shift with delay is 90 degrees at one frequency and varies linearly as you deviate from the center). Again only an issue when the sampling rate is significantly larger than the signal BW. – Dan Boschen Feb 16 '17 at 02:14
1

There can be several reasons.

Computer processing:

One reason to use IQ data for SDR processing is to lower the computational processing rate (to use a slower or lower power processor) for visualization (panadapter) or demodulation without an additional conversion step. Many modulation schemes have asymmetric sidebands. IQ signals can carry disambiguated information about both sidebands around DC (0 Hz) (see explanation here), which means the processing rate can be very close to DC (0 Hz + signal bandwidth + filtering transition safety margin), as opposed to above twice the carrier frequency (plus signal bandwidth, filter transition band, and etc.). In fact, some SDR modules (Funcube Dongle Pro+, Elecraft KX3, etc.) produce IQ data into a PC stereo audio interface (thus allowing processing at very low audio data rates compared to much higher VHF/HF RF carrier or HF/LF IF frequencies).

Radio Hardware:

To do processing with a single channel data stream requires either a very high processing rate (above 2X the RF carrier, using an FPGA, etc.), or some way to get rid of images or aliasing before downsampling/downconversion, usually by an additional conversion or mixing step (or more) to an IF frequency, plus one or more associated anti-aliasing filters for image rejection. Thus, a 2X rate single real data stream usually requires an additional IF stage (and/or a very narrow high frequency bandpass filter, often crystal or SAW) to do this compared to producing a 1X rate IQ data stream. An additional IF stage usually requires an additional oscillator and mixer as well. Whereas direct conversion to IQ data can be accomplished without the need for a high frequency band-pass or roofing filter for image rejection. And even double conversion to IQ data using an IF (intermediate frequency) often requires one less filter or one much lower quality filter (again, for equivalent image rejection).

The downconversion oscillator can be centered (or nearly so) on the signal carrier of interest (either RF or IF), or a low multiple, instead of being either offset or much higher. This can make tracking, phase locking, or synchronizing this oscillator simpler, and thus allow the frequency readout and/or transceiver transmitter signal generation to be simpler in minimal radio hardware.

Conversion hardware:

In hardware, it may be easier or cheaper to implement 2 ADCs at a lower sample rate, than 1 ADC at a higher sample rate. For instance, you can use a stereo sound card with a 44.1k (or 192k) sample rate, instead of a more expensive sound card with a 96k (or 384k) sample rate, for nearly the same signal bandwidth capability.

Chalkboard size:

IQ sample streams (created by two channels of 90 degree phase shifted mixing and/or sampling) also correspond closely to mathematical complex signals (with real and imaginary components), which makes it easier to think of the two channels of real data as one channel of a complex mathematical representation. This makes certain mathematical algorithms (DFT/FFT, complex envelope demodulation, etc.) more directly applicable (and, as mentioned above, at baseband processing rates) with less additional mathematical operations (offsets or fftshifts, etc.)

An explanation or description of these DSP algorithms using complex math usually requires less writing on a classroom chalkboard than equivalent explanations using a non-complex higher sample rate representation (as well as being far more elegant in the opinion of many.) These simpler complex/IQ explanations sometimes directly translate to less code (depending on the HLL computer language at its supported data types), or less computational blocks (using a graphical signal path design tool) is SDR applications.

Tradeoffs:

The downside, of course, is the need for accurate 90 degree phase shift generation, 2 ADCs instead of one, and complex multiplications (4X hardware multipliers or instruction OPs) instead of a single multiplications per (real or IQ) sample, for similar operations.

hotpaw2
  • 35,346
  • 9
  • 47
  • 90
  • 1
    To clarify, the quad generation often is not done in the analog, so that would eliminate much of your downside. The SDR can still "emit" as the poster worded IQ samples to further demodulation software without having to do complex sampling. The rest of your explanation is very good, including the point about the representation being far more elegant. I have stated when describing this to hardware engineers that it "take two scope probes to monitor a complex signal!", meaning it is simple an elegant to describe the system using exponentials but then we need I and Q to implement it. – Dan Boschen Feb 15 '17 at 18:17
1

There are two sides to this story:

(1) what $I$ and $Q$ are from the perspective of a user and

(2) how they are produced.

For this answer I'm going to assume familiarity with complex numbers because this is fundamentally the point of $I$ and $Q$.

Why I and Q?

Euler's formula states that $$ \exp(i\omega t)=\cos(\omega t)+i\sin(\omega t) $$

We can flip this around to get $$\cos(\omega t)=\frac{1}{2}(\exp(i\omega t)+\exp(-i\omega t))$$ and $$\sin(\omega t)=\frac{1}{2i}(\exp(i\omega t)-\exp(-i\omega t))$$ We can think of this as saying that both the $\sin$ and $\cos$ functions are a sum of two parts: one with positive frequency and one with negative frequency.

Why should we care about this? Let’s say you want to shift the frequency of your signal down by some amount, say $\omega_0$.

Suppose by some kind of magic our incoming signal was actually complex valued: $\exp(i\omega t)$. Then it's really easy to shift the frequency down - we make an oscillator that produces the signal $\exp(-i\omega_0 t)$ and multiply our incoming signal by this. Using $\exp(a)\exp(b)=\exp(a+b)$ we get $\exp(i(\omega-\omega_0)t)$.

In reality though (no pun intended) the analogue signal is real-valued and oscillators produce real-valued signals. So an incoming signal is actually more like $\cos(\omega t)$ and our local oscillator is something like $\cos(\omega_0 t)$. Multiplying these gives:

$$\cos(\omega t)\cos(\omega_0 t)=\frac{1}{2}\cos((\omega+\omega_0)t)+\frac{1}{2}\cos((\omega-\omega_0)t) $$

So multiplying by a local oscillator does give a signal with the frequency shifted down, but sadly it has also been mixed with another signal with the frequency shifted up. In principle we can filter out the high frequency part leaving just the low frequency part but filtering is more complicated than multiplication. The reason we get this mixture of both sums and differences of frequencies is that the $\sin$ and $\cos$ functions are mixtures of positive and negative frequency parts. Multiplying by $\cos$ ends up shifting both up and down and mixing the results. If we just had the positive frequency part then shifting the frequency would be no harder than multiplication. In general, any kind of analysis of the signal will be confused by the fact that there are positive and negative frequency parts present - eg. when you want to find the instantaneous frequency in FM demodulation.

Notice how even though the original signal is real (eg. $\cos(\omega t)$), when you remove the negative frequency part you get a complex number (eg. $\exp(i\omega t)$). This complex number has real and imaginary parts. They are conventionally called $I$ and $Q$.

And that's basically it. If your incoming signal was a sum of lots of sine waves of differing amplitude and phase, ie. $$ \sum_{k=1}^N A_k\cos(\omega_k t+\phi_k) $$ then the signal delivered to the SDR user is $$ I+iQ = \sum_{k=1}^N A_k\exp(i(\omega_k t+\phi_k)) $$ In practice it's conveniently shifted down in frequency for you by some amount $\omega_0$. But that's just multiplication by $\exp(-i\omega_0 t)$. So the actual $Q$ and $I$ you receive are given by $$ I+iQ = \sum_{k=1}^N A_k\exp(i((\omega_k-\omega_0)t+\phi_k)) $$

It's now easier for users to shift the frequencies up and down to look at different parts of the spectrum. It's also convenient in other ways - for example in (vanilla) FM demodulation you can read off the signal (ie. the instantaneous frequency) as the rate of change of the phase of the complex signal. This is a tiny bit of code. Additionally I find it much easier to reason about $\exp$. There are no trig formulae to remember. Lastly, we get two samples at each moment in time which gives the potential to pack more information into our signal.

How do you generate I and Q?

The other side of the story is how $I$ and $Q$ are generated. The question doesn't explicitly ask for this but it seems to be standard practice to answer it anyway.

At first it may even seem impossible to do this. No matter how long you spend looking at the real part of a number you can't magically infer what the imaginary part is. The key is to look at filtered signals.

I mentioned that you can shift frequency down by multiplying (in the analogue hardware) by a real-valued locally generated $\cos$ signal and filtering before sampling. That's the $I$ signal. (Or at least that's one way to get it.) $Q$ is then generated by multiplying the original signal by $\sin$ instead of $\cos$, filtering and sampling.

Repeating what I said above, if the incoming signal is $\cos(\omega t)$ and we multiply by $\cos(\omega_0 t)$ we get

$$\cos(\omega t)\cos(\omega_0 t) = \frac{1}{2}\cos((\omega+\omega_0)t)+\frac{1}{2}\cos((\omega-\omega_0)t) $$ which, when filtered, becomes $$ \frac{1}{2}\cos((\omega-\omega_0)t) $$

Similarly we can separately multiply the signal by $\sin(-\omega_0t)$ $$\cos(\omega t)\sin(-\omega_0 t) = \frac{1}{2}\sin((\omega-\omega_0)t)-\frac{1}{2}\sin(\omega+\omega_0)t) $$ and filtering out the high frequencies gives $$ \frac{1}{2}\sin((\omega-\omega_0)t) $$.

So (apart from an irrelevant a factor of 2) this process gives us the real and imaginary parts of $\exp(i(\omega-\omega_0)t)$ which is the same as $\cos((\omega-\omega_0)t)$ with the negative frequency part removed. (You can think of this as being a way to implement multiplication by $\exp(-i\omega t)$ followed by filtering in a circuit.

I originally said that it's a pain to multiply by $\cos$ and then filter, it's easier to work with complex values. And yet here I've said that the hardware does this anyway. But there is a point to this - once you've computed $I$ and $Q$ once you can now shift the frequency up and down as often as you like by multiplication. If you only gave the user $I$ you'd have to do the multiplication and filtering again every time you tried to shift frequency.

TBH I find the standard notation a bit confusing. I think it's easiest to think of $I+iQ$ as a single entity, a complex-valued signal, rather than as two separate things with different names (“in-phase” and “quadrature”). When you dig into SDR software it often goes straight to $I+iQ$ and from that point onwards the code works with this complex representation. For example look at the demodulators for SDR++. Also, I find it confusing that many explanations start with how $I$ and $Q$ are generated. This is good if you make SDR devices, but not if you’re a user.

Note that $Q$ and $I$ are sampled simultaneously. As far as I know $Q$ is not simply another sample taken $\frac{1}{4}$ of a cycle later even though it seems popular to say things like this. What's happening is that we multiply our signal by both $\cos(\omega_0 t)$ and by $\sin(-\omega_0 t)$ and the latter is a $\frac{1}{4}$ cycle out of phase with the former. (But I guess it's possible that alternative schemes are sometimes implemented - for example instead of multiplying by $\cos(\omega_0 t)$ and by $\sin(-\omega_0 t)$ you could multiply both the original signal and a delayed signal by $\cos(\omega_0 t)$ or some variation.)

Dan Piponi
  • 143
  • 6
  • +1 and kudos on thinking of I+jQ as a single complex sample and getting all those sin sin , sin cos relationships out of the path to understanding single sideband and IQ mixing! – Dan Boschen Jan 10 '24 at 14:45
  • Trig formulae are hard! Any technique to eliminate them is worthwhile IMO :) – Dan Piponi Jan 10 '24 at 21:22
  • Also with your last paragraph, it's worth mentioning that a delay of exactly 90 degrees at the center frequency has a linear phase vs frequency so introduces distortion (that can be equalized) as it loses quadrature as we approach the band edges. If the bandwidth is significantly smaller than the center frequency, the error can be insignificant such that that technique can be simple to do (as well as every other sample in decimate by two schemes when the sampling rate is high enough). Ultimately time delay and phase shift are not the same unless we are only talking about a single frequency. – Dan Boschen Jan 11 '24 at 10:21