0

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?

  • 1
    "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$. – Matt L. May 16 '23 at 11:48
  • 1
    Also see https://dsp.stackexchange.com/q/431/11256 – MBaz May 16 '23 at 17:06
  • 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. – OverLordGoldDragon May 17 '23 at 14:19
  • 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. – OverLordGoldDragon May 17 '23 at 18:26
  • 1
    @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. – Violet Giraffe May 17 '23 at 18:29

2 Answers2

2

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.

Jason C
  • 256
  • 2
  • 6
  • 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 [meta], or in [chat]. Comments continuing discussion may be removed. – Peter K. May 20 '23 at 01:41
  • @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. – Jason C May 20 '23 at 12:39
  • 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. – OverLordGoldDragon May 20 '23 at 14:31
  • @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 – OverLordGoldDragon May 23 '23 at 23:43
  • 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. – OverLordGoldDragon May 23 '23 at 23:43
0

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} $$

robert bristow-johnson
  • 20,661
  • 4
  • 38
  • 76
Hilmar
  • 44,604
  • 1
  • 32
  • 63
  • 1
    More properly, $X[k]$ and $z[n] = \texttt{iDFT}{X}$ are periodic with $N$, unrelated to $x[n]$. – OverLordGoldDragon May 16 '23 at 12:53
  • Thank you for the detailed answer. What is a negative frequency, then? Frequency is the number of cycles per unit time. The cycle count is non-negative by definition, and while time can be negative in some physics calculations, I don't understand what a negative frequency could possibly mean when my actual received signal clearly has positive frequency. – Violet Giraffe May 16 '23 at 12:54
  • Did you mean that X[k] is periodic over N/2? Otherwise I don't see how shifting by N/2 (half a period) is valid. And more importantly, the DFT result is obviously not periodic over N/2, if it was I wouldn't have spent hours upon hours trying to figure out what to do with the upper half. – Violet Giraffe May 16 '23 at 12:55
  • 1
    @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} ? – Hilmar May 16 '23 at 13:28
  • 2
    @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. – Hilmar May 16 '23 at 13:30
  • If they are transform pairs, yes. Transforming $x[n]$ doesn't make it a pair though. The problem's with the formulation of your claim that the definition implies $x[n]$ is periodic. That a definition exists somewhere doesn't make all finite sequences periodic. $\texttt{iDFT}$ recovers $x[n]$ as a slice of the periodic transform pair $z[n]$, that's all. – OverLordGoldDragon May 16 '23 at 13:46
  • 1
    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. – Hilmar May 16 '23 at 14:25
  • Thank you for the clarification, now I understand the part about the period of N, but I don't see at all how it answers my question (and I don't feel any closer to the answer than I was before asking). Okay, if you define negative frequency as that of negative rotation - makes sense. But I'm analyzing a real physical signal, I/Q sampled. I got the FFT result. How do I plot the power or amplitude (doesn't matter which) versus frequency? What to do with the upper half of the bins? There were no negative frequencies in the radio signal. – Violet Giraffe May 16 '23 at 15:04
  • There absolute are negative frequency in any real world physical signal. It's impossible for any physical quantity (field strength, voltage, current, pressure, etc.) not to have negative frequencies. The only signals that do not have negative frequencies are complex signals where real and imaginary parts are related through the Hilbert Transforms. That doesn't happen in nature but certainly can be constructed that way, but it's really just two real-valued signals paired up. Just fold over the top half and plot the spectrum from $[-N/2, N/2-1]$. – Hilmar May 16 '23 at 16:45
  • If we take sound processing as an example. The quantity is voltage recorded by a microphone. For a monotone sound of 100 Hz the voltage will be a sine wave of 100 Hz. We then sample the continuous signal at Fs >> 100 Hz, and when we run FFT of the sampled digital signal, we expect a single peak in the bin(s) closest to 100 Hz (and, optionally, some DC). Where are the negative frequencies, and what is the meaning of the upper half of the bins? – Violet Giraffe May 16 '23 at 17:09
  • 1
    @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. – Hilmar May 17 '23 at 11:27
  • That's what I'm getting at, in this case the -100 Hz value is processing artifact, garbage. But for a quadrature-sampled signal there is no symmetry and the values do have actual meaning (they're not only required for IFFT to work), is that correct? – Violet Giraffe May 17 '23 at 11:51
  • @VioletGiraffe Followup questions should be asked separately. This isn't a casual discussion forum. – OverLordGoldDragon May 17 '23 at 14:23
  • @OverLordGoldDragon, there were no follow-up questions, it's the same question. I was trying to coerce the answer into actually answering the question as stated. – Violet Giraffe May 17 '23 at 17:35
  • @VioletGiraffe You bring power and audio into this, that's not in the original question. What's "right" for negatives differs based on purpose. So, overly broad or unfocused, and to that end you've gotten sufficient responses. Either way this information should be edited into the question, not spread around in comments. – OverLordGoldDragon May 17 '23 at 17:47
  • @OverLordGoldDragon: the question is complete, it states exactly what kind of information is being analyzed, and no answer has been given thus far that relates to complex quadrature-sampled signals. – Violet Giraffe May 17 '23 at 17:54
  • 1
    @VioletGiraffe I'm not interested in deconstructing the flaws but they're there and indeed I've not conveyed them entirely correctly. I also agree you've not received a satisfactory answer. You assert "doesn't make sense per Nyquist" without explaining why - there should be nothing wrong with Nyquist, so that should be removed or explained. "How to interpret spectral content" is too broad. State a more specific problem - your comments are doing better than the original question. And downvote overrated answers, this network has an epidemic of upvoting stuff that only appears to be "answers". – OverLordGoldDragon May 17 '23 at 17:59
  • @VioletGiraffe: "That's what I'm getting at, in this case the -100 Hz value is processing artifact, garbage" That's your problem right here. It is NOT a processing artifact or garbage. It is a fundamental property of real signals . If you want to use the Fourier Transform you have to accept the way the Fourier Transform defines "frequency". If that doesn't match with your own definition you will have to use a different transform that suits your needs better. – Hilmar May 18 '23 at 13:46
  • 1
    The Fourier Transform is an orthogonal transform using complex exponentials as basis functions. It does NOT use sine or cosines. If you want that maybe take a look at the discrete cosine transform instead. – Hilmar May 18 '23 at 13:47
  • @Hilmar, I am up arrowing every answer and comment of yours here, but I think this last comment is problematic. The Fourier Transform (Discrete or Continuous) is less general than the Z Transform or Laplace Transform. The basis functions are not *general* complex exponentials but are exponentials with *purely* imaginary exponents. So, in a very real and meaningful manner, the basis functions *are* sines and cosines. – robert bristow-johnson May 20 '23 at 21:53
  • That's what makes it periodic and that's what makes you completely correct insisting that: "If $x[n]$ and $X[k]$ are DFT transform pairs, they are both periodic with $N$ and that's all there is to it." ----- You are *sooooooooooooo* completely correct about that, which is still being disputed by some other people pretending to know better. – robert bristow-johnson May 20 '23 at 21:56
  • Thanks for the comment. Sloppy wording on my part. – Hilmar May 21 '23 at 00:56
  • Here, from here and here. Also it appears you knowingly don't @ when replying, after two or three of my notices, so I'll play along. If you forgot, another reminder - >1 responders means I'm not notified without @. – OverLordGoldDragon May 24 '23 at 21:18