# How to reconstruct RF signal using IQ data

I have a complex IQ signal: $s = X + Yi$. I know my original $f_0$ was $5\textrm{ MHz}$.

I can calculate the magnitude/amplitude of $s$: $A = \sqrt{X^2 + Y^2}$ and phase, $\phi = \arctan\left(\frac YX\right)$

But how can I reconstruct the signal using this frequency, amplitude and phase data?

I need the output as a time varying signal which incorporates the amplitude and phase information from the IQ data. I have found this:

The reconstruction of RF-data from IQ-data is straightforward. It is a reversal of the complex demodulation in the previous section. The decimation is reversed by interpolation. The low- pass filter cannot be reversed, but should be chosen without loss of information in the first place. The down mixing is reversed by up mixing. At last, the RF-signal is found by taking the real-value of the complex up-mixed signal.

But I could really do with a worked example.

EDIT:

This MATLAB code appears to do what I want:

IQ = resample(IQ,downsampl,1);

[Z,X] = size(IQ);
time = [0:Z-1]'*1/F * ones(1,X);

signal = IQ .* exp(+2*pi*i*time*carrier);

signal = real(signal);


where resample resamples IQ at downsampl/1 times.

It is not clear to me what I should use for downsampl and what F is?

The RF signal $r(t)$ is obtained from the complex baseband (IQ) signal $s(t)=x(t)+jy(t)$ in the following way:

$$r(t)=\text{Re}\{s(t)e^{j\omega_0t}\}\tag{1}$$

where $\omega_0$ is the carrier frequency (in rad/s). There are two other equivalent representations of $(1)$, where I use $s(t)=x(t)+jy(t)=a(t)e^{j\phi(t)}$:

\begin{align}r(t)&=x(t)\cos(\omega_0t)-y(t)\sin(\omega_0t)\tag{2}\\ r(t)&=a(t)\cos(\omega_0t+\phi(t))\tag{3}\end{align}

Eq. $(2)$ shows that the I- and Q-components are both modulated by orthogonal carriers, whereas $(3)$ shows that $r(t)$ generally exhibits amplitude modulation as well as phase modulation.

The quote in your question suggests that in the respective text the signals are all represented as discrete-time signals, hence the decimation and interpolation stages.

• Ok. I understand above. I think I can use: I=real(s) Q=imag(s) fc = 5000000; % Carrier frequency in Hz C1 = I .* sin(2*pi * fc * t); C2 = Q .* cos(2*pi * fc * t); rf = C1 + C2; but what to use for t? – 2one Aug 16 '16 at 16:35
• @2one: If $B$ is the bandwidth of $s(t)$, and if you want to satisfy the Nyquist sampling theorem, you must sample at $f_s>2(f_c+B)$. Then you sample by setting $t=n/f_s$ with integer $n$. – Matt L. Aug 16 '16 at 17:40
• @2one: If the answer was helpful, please accept it by clicking on the check mark to its left. – Matt L. Aug 16 '16 at 17:53
• please could you help me with the question edit? – 2one Aug 17 '16 at 9:31
• @2one: I can't say much more than I did in my previous comment. You have to know the bandwidth of your IQ data, you have to know the sampling rate of the IQ data, and the frequency of the carrier. You choose the new sampling frequency according to the formula in my previous comment. E.g., if the RF sampling frequency is 20MHz and the IQ sampling frequency is 2 MHz, then the upsampling/interpolation factor is 10. And F in your code is the new sampling frequency (20 MHz in my example). – Matt L. Aug 17 '16 at 11:26

Just use the received I/Q signal $X(t) + jY(t)$ directly, and feed it back directly to your RF IQ mixer/upconverter.

Signal to transmit = $X(t)cos(2\pi f_0t) - Y(t)sin(2\pi f_0t)$