# What does correcting IQ do?

Some software (for example SDR Sharp) has a "Correct IQ" option. This is used to get rid of the DC spike in the middle of the display. What does this setting do to the signal? What is wrong with the IQ values that needs to be corrected?

Real RF devices are not ideal as in a simulation or theoretic calculation. In particular, RF devices produce (among others) the following effects:

The correct IQ option is there to estimate these effects and remove them via digital or analog signal processing.

The "spike in the middle of the display" is an artifact that stems from the DC offset. I suppose you look at the spectrum of the signal and there's a spike at the center (i.e. frequency 0). The spike shows the mean of the signal, which is not zero when there is DC offset. Hence, if you remove the DC offset, the mean of the signal will be zero and the spike is removed.

• I debated whether or not to include the DC offset in my answer. I opted not to, since I usually handle this separately from (what I consider to be) the IQ imbalance problem. Thanks for including it in yours. – hops May 4 '17 at 6:11

Here are some graphics I have to add to the other good answers, as well as typical correction schemes for DC Offset and IQ Imbalance.

DC OFFSET

Below is an example DC Offset on a 16 QAM signal (with some added AWGN). In this example the offset if shifted by an amount such that the power in the fixed vector representing the shift is 10 dB below the total power in the signal. Notice that the shift can be at any magnitude and phase and the fact that it does not change with time makes it "DC". Also notice that even though it is 10 dB BELOW the total power in the signal, it appears significantly higher in the spectrum plot which may confuse some observers: this is because the waveform's power is spread over the modulation bandwidth, so the power in each FFT bin is lower than the power in the DC offset. Below is a simple approach for eliminating DC offset. This filter is also introduced in this post: Transfer function of second order notch filter, where the gain constant $\alpha$ controls the bandwidth, getting tighter as $\alpha$ approaches 1. IQ IMBALANCE

IQ Imbalance is demonstrated on the same 16 QAM signal in the next figure below, showing how it can result from either amplitude imbalance or phase imbalance or both. With amplitude imbalance, the scale of one axis is changed from the other, with phase imbalance, the axis are no longer in perfect quadrature. The correction for IQ Imbalance is done as in the figure below with an $\alpha$ gain factor shown for amplitude imbalance and a $\beta$ gain factor shown for quadrature imbalance. One may "Correct IQ" to correct gain and phase imbalances in the I signal and the Q signal. These imbalances can lead to artifacts in the output (resulting in signal distortion). The IQ signaling is based on the idea that a real signal has been down converted with two sine waves of equal amplitude that are at 90 degree angles with respect to each other. An imbalanced IQ signal has been down converted with two sine waves of either unequal amplitudes or not at 90 degrees with respect to each other or both.

For a balanced IQ signal, we obtain $$x_I(t) = x(t) \cos(2 \pi f_c t)$$ and $$x_Q(t) = x(t) \sin(2 \pi f_c t).$$ When this is true, the two carrier waves are orthogonal to each other and carry orthogonal (independent) signal information. When these are imbalanced, the orthogonality is lost so the components become correlated.

To put this on solid ground, let us consider an example.

Let $A$ be the ratio of amplitude of the Q carrier wave to the (normalized) I carrier wave. Also, let $\phi$ be the difference in phase offsets from the I cosine to the Q sine wave. With these definitions, the imbalanced down converted signal can be expressed as $$x'_I(t) = x(t) \cos(2 \pi f_c t)$$ and $$x'_Q(t) = A x(t) \sin(2 \pi f_c t - \phi).$$ Now, let us apply familiar trig identities to $x'_Q(t)$ to obtain $$x'_Q(t) = A x(t) \sin(2 \pi f_c t) \cos(\phi) - A x(t) \cos(2 \pi f_c t) \sin(\phi).$$

Notice that the imbalanced quadrature component $x'_Q(t)$ in this case is equal to a scaled version of the balanced quadrature component $x_Q(t)$ plus a scaled version of the in-phase component $x_I(t)$. In other words, $x'_Q(t) = A \cos(\phi) x_Q(t) + A \sin(\phi) x_I(t)$.

Since the imbalanced signal components are no longer in quadrature, they will appear distorted from the balanced case. For example if $x(t) = \cos(2 \pi f_c t)$, then we obtain (in the balanced case) $$x_I(t) = \cos^2(2\pi f_c t) = \frac{1 - \cos(4 \pi f_c t)}{2}$$ and $$x_Q(t) = \cos(2\pi f_c t)\sin(2\pi f_c t) = \frac{1}{2}\sin(4 \pi f_c t).$$ In the unbalanced case, we obtain $$x'_I(t) = \cos^2(2\pi f_c t) = \frac{1 - \cos(4 \pi f_c t)}{2}$$ and $$x'_Q(t) = \frac{A \cos(\phi)}{2}\left(1 - \cos(4 \pi f_c t)\right) + \frac{A \sin(\phi)}{2}\sin(4 \pi f_c t).$$

As an example of the difference from the ideal case, consider what would happen if we filtered out the high frequency components in both cases, we obtain a difference in amplitude for the imbalanced case. This difference depends on both the amplitude difference ratio ($A$) and the quadrature phase difference ($\phi$) of our two carrier waves. Correcting for IQ imbalance, means performing a digital operation (a linear combination of the I and Q channels) to restore the orthogonality of the I and Q signals. This is usually done in the digital domain after a characterization of the I and Q imperfections have been made.

Notice that if we express the balanced and unbalanced forms in matrix/vector notation, we arrive at the relationship $$\left[\begin{array}{c} x'_I(t) \\ x'_Q(t)\end{array}\right] = \left[\begin{array}{cc} 1 & 0 \\ A \sin(\phi) & A \cos(\phi) \end{array}\right] \left[\begin{array}{c} x_I(t) \\ x_Q(t)\end{array}\right]$$ which implies a method of correcting the IQ imbalance. Simply, multiply the vector of unbalanced signals by the inverse of the matrix (it exists if $A \neq 0$ and $\phi$ is not an odd multiple of $\frac{\pi}{2}$ radians).

A potential downside to this processing is that the noise may be amplified in the Q channel. For typical values of $A$ close to unity and $\phi$ close to zero, this noise amplification is negligible.