0
$\begingroup$

I know it's a very basic question, but I've spent almost a full work day researching and still can't find a clear (or even just usable) answer. For the DFT of a real-valued signal the second half of the bins is just conjugates of the first half and can/should be ignored. But what about the complex-valued I/Q signal? I see no correlation between the values in the second and first halves of the bins. And yet, according to the F = k * Fs/N formula,the second half of the bins correspond to the frequencies that make no sense as per the Nyquist theorem. Saying that it's "negative frequencies" doesn't make it any better.

How do I correctly interpret the second half of the bins to plot / analyze the spectral content of the signal?

$\endgroup$
5
  • 1
    $\begingroup$ "Saying that it's "negative frequencies" doesn't make it any better." But that's what they are. The spectrum of a complex signal is not conjugate symmetric, so the negative frequencies are not redundant as they are for real-valued signals. Note that the spectrum of a discrete-time signal is periodic, so you can just shift the second half of the bins to the left and plot the spectrum from $-f_s/2$ to $+f_s/2$. $\endgroup$
    – Matt L.
    May 16, 2023 at 11:48
  • 1
    $\begingroup$ Also see dsp.stackexchange.com/q/431/11256 $\endgroup$
    – MBaz
    May 16, 2023 at 17:06
  • $\begingroup$ Negative frequencies exist, are ignorable but not equivalently nonexistent for real-valued signals, and interpret especially nicely for complex-valued signals - see MBaz's reference, also this example. $\endgroup$ May 17, 2023 at 14:19
  • $\begingroup$ I'm not familiar with "I/Q" but isn't it defined as 90 degree phase between real and imaginary part, meaning the spectrum is non-zero over only positives or negatives? I'm not finding any clear references on spectral properties of I/Q. I'm certainly familiar on many uses of positives vs negatives but can't comment here, would help to explain a bit but that's probably just for me and not required. Also I was referring to the other answer in my comment but up to you. $\endgroup$ May 17, 2023 at 18:26
  • 1
    $\begingroup$ @OverLordGoldDragon: I appreciate your feedback, I will expand the question later today. And yes, quadrature sampling means sampling with two ADCs at a 90 degrees offset, and the two streams of samples are referred to as I and Q. $\endgroup$ May 17, 2023 at 18:29

2 Answers 2

2
$\begingroup$

It may be useful to go through an example of how the complex-valued I/Q data is produced from real-valued signals and then explore how that relates to DFT bins.

Down-conversion example

In communications, it is often convenient to "down convert" some physical signal (like a radio or television broadcast) down to "baseband" I/Q for further processing.

Suppose we have some real-valued signal $x(t)$ that has energy only in the neighborhood of some frequency $f_c$, which we will call the "center frequency." Again, imagine a radio station, and $f_c$ is the broadcast frequency. A cartoon version of the spectrum of that signal would look something like this:

enter image description here

(Notice I have drawn the negative frequency replica. I am sorry, but it is unavoidable!)

The negative frequencies are the mirror image of the positive frequencies, and if you sampled this signal and took an FFT, you would see half the bins are conjugates of the other, like you are used to seeing in your FFTs of real-valued signals.

We wish to shift one of the replicas down to be centered at 0 Hz. We can do this by multiplying by a complex exponential:

$x_s(t) = e^{-j2\pi f_c t} x(t)$

This will shift everything in the frequency domain by $-f_c$:

enter image description here

Note that we started out with a real-valued signal, but after multiplication by a complex exponential, the signal is complex, and the negative and positive halves of the spectrum are no longer symmetric.

Okay, our desired signal is centered at 0 Hz, that's great, but we still have the red replica hanging around, now centered at $-2f_c$. We need to apply a filter to get rid of it. Let's just say we have some filter with an appropriate impulse response $h(t)$ that we can convolve with $x_s(t)$ to get rid of the replica:

$x_f(t) = x_s(t) * h(t)$

Now our spectrum looks like this:

enter image description here

Okay, now we're done with down-conversion! This last figure represents the spectrum of the I/Q data that you are analyzing. By the time one has "I/Q data", it is implied that a process of shifting and filtering relative to some center frequency $f_c$ has already been done.

So now we have a complex signal with negative frequencies different from positive frequencies, how can we interpret this?

Interpretation of negative frequencies

If we compare the first figure to the last figure, we can see that the "negative frequencies" correspond to frequencies below $f_c$, and the "positive frequencies" correspond to frequencies above $f_c$. So "negative" and "positive" frequencies can be thought of as being relative to some center frequency, and even the "negative" frequencies were still positive in the physical world before the down-conversion process.

Relationship to DFT bins

The DFT (which the FFT calculates) is defined as:

$$X[k] = \sum_{n=0}^{N-1} x[n]e^{-j(2\pi / N)kn}$$

Where $x[n]$ is a time domain sequence and $X[k]$ is the frequency domain transform. The bins indexed from $k = N/2$ to $k = N-1$ range in frequency from $\pi$ to "almost" $2\pi$ radians per sample.

Because the DFT has a period of $2\pi$ in the frequency domain, we could instead consider the $k = \{N/2,...,N-1\}$ bins to range in frequency from $-\pi$ to "almost" 0 radians per sample. These are the bins that will pick up the energy below 0 Hz in the last figure above.

It is very common to move those frequencies to the front of an array, so that the frequencies range from $-\pi$ to "almost" $+\pi$, with DC in the middle, using the "fftshift" function. (MATLAB version, Python version).

Notice that we are considering FFT bin $k = N/2$ bin to have frequency of $-\pi$ radians/sample, grouping it with the negative frequencies. This is purely a matter of convention: We could equally well have considered to have $+\pi$ radians/sample frequency, and grouped it with the positive frequencies.

I bring this up because it sometimes strikes people as strange that an FFT of length N (with N even) has a DC bin, $N/2$ negative frequency bins, and $N/2 - 1$ positive (and non-zero) frequency bins. Why the asymmetry? But it is purely a result of the convention of placing the $k = N/2$ bin with the negative frequencies.

$\endgroup$
5
  • $\begingroup$ Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Signal Processing Meta, or in Signal Processing Chat. Comments continuing discussion may be removed. $\endgroup$
    – Peter K.
    May 20, 2023 at 1:41
  • $\begingroup$ @VioletGiraffe, I have edited my answer to try to tighten it up. If you don't mind, could you please comment on whether the answer as it stands now would have answered your question standalone? (ie, with no external discussion) And whether there remains anything unclear to you? I am trying to improve my writing, and I would appreciate any feedback. $\endgroup$
    – Jason C
    May 20, 2023 at 12:39
  • $\begingroup$ If you're trying to improve, learn to spot a bad question, and call it out. StackExchange isn't for bending over backwards for users. Otherwise is contributing to this network's epidemic. $\endgroup$ May 20, 2023 at 14:31
  • $\begingroup$ @JasonC Sorry about my blunt comment. Given your StackOverflow rep, I've mistaken you for a veteran user - I double checked as that'd be quite strange given your 'niceness'. Here's the thing, it doesn't hurt users' fingers to do more clicking and typing. And I only care about "enforcing rules" if they align with my "agenda". My agenda is simple: (1) be rewarded for my work, rep matters; (2) if I faithfully solved the original question (which I had expectations for how much work it'd take), and the user keeps piling on instead of opening separately, it adds work I've not signed up for $\endgroup$ May 23, 2023 at 23:43
  • $\begingroup$ while withholding the reward; (3) significant part of my answering shouldn't involve decoding the question. All are in the user's hands, and not insisting on it encourages complacency where answers are simply not good enough unless we solve the whole project for them. To contrary they're clearly dissatisfied, while also being ones asking for expert labor. Straight up disrespect, without intending, because of how the site's set up. Nobody complains of a professor who doesn't do their homework for them. It's expectations. $\endgroup$ May 23, 2023 at 23:43
0
$\begingroup$

For the DFT of a real-valued signal the second half of the bins is just conjugates of the first half

Correct

and can/should be ignored.

Wrong. They need to be included in any calculation (inverse DFT, power, autocorrelation, etc.). Most people choose not to display them since the information is redundant. But that doesn't mean, it's not there and can be ignored.

the second half of the bins correspond to the frequencies that make no sense as per the Nyquist theorem.

Wrong again. The DFT is given as

$$X[k] = \sum_{n=0}^{N-1} x[n] e^{-j2\pi\frac{kn}{N}} \leftrightarrow x[n] = \frac{1}{N} \sum_{k=0}^{N-1} X[k] e^{j2\pi\frac{nk}{N}} \tag{1} $$

I.e. it transforms $N$ independent complex numbers into another set of $N$ independent complex numbers. You need all of them. The definition also implies that both $X[k]$ and $x[n]$ are periodic with $N$, i.e. $X[k] = X[k+mN], m \in \mathbb{Z}$

The Nyquist criteria states that you need 2 samples per Hz of bandwidth. Given that the signals are periodic you can choose to center this bandwidth anywhere. The most common choices are $[-N/2,N/2-1]$ or $[0,N-1]$ but any other choice is fine too (google for example "bandpass sampling").

Saying that it's "negative frequencies" doesn't make it any better.

But it does! Let's look at a simple example:

$$x[n] = e^{-j2\pi\frac{n}{N}} \tag{2}$$

The DFT of this is $X[k] = \delta[k+1]$, i.e. it only has one single non-zero value. And that value is at $k = -1$ or $k = N-1$, depending what frequency range you look at it.

If you only look at the positive half of the spectrum, you'd see all zeros which obviously can't be right. In this case $x[n]$ consists of only one frequency, which is indeed negative.

The frequency symmetry for real signals arises from the fact that real signals always have the same amount of negative and positive frequencies (more or less), so you don't need to track them separately. For example

$$\begin{align}x[n] = e^{-j2\pi\frac{n}{N}} &\leftrightarrow X[k] = \delta[k+1]\\ x[n] = e^{+j2\pi\frac{n}{N}} &\leftrightarrow X[k] = \delta[k-1]\\ x[n] = \cos(2\pi\frac{n}{N}) &\leftrightarrow X[k] = \frac{1}{2}(\delta[k+1] + \delta[k-1]) \end{align} \tag{3} $$

$\endgroup$
23
  • 1
    $\begingroup$ More properly, $X[k]$ and $z[n] = \texttt{iDFT}\{X\}$ are periodic with $N$, unrelated to $x[n]$. $\endgroup$ May 16, 2023 at 12:53
  • 1
    $\begingroup$ @VioletGiraffe: $X[k]$ and $x[n]$ are periodic with $N$. You are NOT shifting anything, you can simply choose which period to look at. You need one complete period , that's all. Re Frequency: You can think about it in terms of rotation: there are two different directions: clockwise and counter clockwise. How else would you distinguish between e^{+\omega t} and e^{-\omega t} ? $\endgroup$
    – Hilmar
    May 16, 2023 at 13:28
  • 2
    $\begingroup$ @OverLordGoldDragon: sorry, I have no idea what that's supposed to mean. If $x[n]$ and $X[k]$ are DFT transform pairs, they are both periodic with N and that's all there is to it. $\endgroup$
    – Hilmar
    May 16, 2023 at 13:30
  • 1
    $\begingroup$ I'm still not getting it. $x[n]$ and $X[k]$ are clearly defined as transform pairs in equation (1). So unless you redefine $x[n]$ my statement holds. It follows directly from the definition of the DFT that both signals are periodic. You can certainly apply a DFT or IDFT to non-periodic signals, but these are not the signals as defined in my answer. I clearly define $x[n]$ is the IDFT $X[k]$ and hence its periodic. $\endgroup$
    – Hilmar
    May 16, 2023 at 14:25
  • 1
    $\begingroup$ @VioletGiraffe: if you have a sound recording of 100Hz sine wave and run an FFT on it, you will get TWO non-zero values. one at 100Hz and one at -100Hz. That's simply a fact of how the Fourier Transform defines "frequency" and Euler's formula: $\cos(x) = 1/2(e^{+jx}+e^{-jx}) . I'm sorry, but your expectation is wrong. Intuition and expectation won't get help you much here: you will have to have a good grasp of the underlying math and principles. $\endgroup$
    – Hilmar
    May 17, 2023 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.