Demodulating I/Q Data

Messages In The Air


In the last post, we covered the basics of complex signals and how they work in digital signal processing (DSP) systems. The next question is how do we demodulate these signals and find the messages in them? To answer that, we need to update our model of the incoming signal.

Previously, we used Euler's formula as the basis for our model of complex signals. While this is great to keep in mind, it was only correct given a pure sinusoid as the incoming signal. In reality, we can't make many assumptions about the signal, so modeling it as a simple sinusoid isn't always accurate. We need a more abstract way to model more realistic signals.

Aeiθ=Acos(θ)+iAsin(θ)Ae^{ i\theta } = A\cos (\theta) + iA\sin (\theta)

Recall that cos(θ)\cos (\theta) represented the in-phase, or II, portion of our complex signal and sin(θ)\sin (\theta) represented the quadrature, or QQ, portion. Since we're not sure that our I and Q functions will be simple sinusoids like sine and cosine, we can use abstract functions like I(t)I(t) and Q(t)Q(t). This way, we arrive at a new, more abstract way to model any signal we'll be receiving over the air.

s(t)=I(t)+jQ(t)s(t) = I(t) + jQ(t)
Where ss is the incoming signal, jj is our imaginary unit, and tt is some point in time.

How do we demodulate our signal with this formula? Well, to modulate a signal is to change one of its properties according to the message it encodes. So, to demodulate the signal we must be able to extract these properties from our new signal formula.

Remember the phasor from our last post and how it modeled our wave. We can use it to help calculate how we can get properties like amplitude, phase, and more using our formula. Finding these properties lets us demodulate the signal.

Phase Angle: 0.00°Amplitude: 1.00
Move the slider to change the amplitude.

To help us better understand the math and visuals for these concepts, notice that our phasor is always making a triangle.

Here, AA, BB, and CC are sides of a triangle formed by our phasor. θ\theta is an angle.

We can use algebra and trigonometry to find certain values when given others, which will ultimately give us characteristics of our signal.

Amplitude

A(t)=I2(t)+Q2(t)A(t) = \sqrt {I^2 (t) + Q^2 (t)}
Where A(t)A(t) is the amplitude of the signal at a point in time, or instantaneous amplitude.

The Pythagorean Theorem concludes that A2+B2=C2A^2 + B^2 = C^2. With that in mind, we can get CC, the hypotenuse of our triangle above, with just AA, on the horizontal axis, and BB, on the vertical axis, by rearranging the equation into C=A2+B2C = \sqrt {A^2 + B^2}. Applying this formula to our signal function with I(t)I(t) being on the horizontal axis and Q(t)Q(t) being on the verical axis yields a formula that gives us the amplitude of the signal at a certain point in time.

Phase

ϕ(t)=tan1(Q(t)I(t))\phi (t) = tan^{-1} \left( \frac {Q(t)} {I(t)}\right)
Where ϕ(t)\phi(t) is the phase of the signal at a point in time, or instantaneous phase.

In our triangle above, we can get θ\theta from AA and BB using the inverse tangent function. That is, θ=tan1(BA)\theta = tan^{-1} \left( \frac {B} {A} \right). Applying this formula to our signal function yields a formula that gives us the phase of the signal at a certain point in time.

Frequency

f(t)=(1Δt)tan1(I(t)Q(t1)+Q(t)I(t1)I(t)I(t1)Q(t)Q(t1))f(t) = \left( \frac {1} {\Delta t} \right) tan^{-1} \left( \frac {I(t) Q(t-1) + Q(t)I(t-1)} {I(t)I(t-1) - Q(t)Q(t-1)} \right)
Where f(t)f(t) is the frequency at a point in time.

Quite frankly, I'm not going to try and explain this formula. Just know that we can calculate the signal's instantaneous frequency by calculating the instantaneous change in the signal's phase.

But why this way?

Using this I/Q model in our DSP system gives us a relatively easy way to process signals with low or negative frequencies. In my opinion, it also happens to make modeling signal properties easier and more robust, thus making demodulation easier.

To wrap up

I hope this made the concept of RF signal demodulation a bit easier to understand. If you have any questions or would like to offer ways that I can improve this post, feel free to contact me.