From what I have read about signal (de)modulation I understand that multiplying two sine waves, both with the same frequency, gives a two frequency component sine wave. One at DC and one at $2\omega$. Using a low pass filter will let us remove the $2\omega$ component. Now DC amplitude is proportional to the phase difference between the two sine waves.

So: $$ A \sin(\omega t) \sin(\omega t + \theta) = \frac{A}{2}\cos(\theta) + \frac{A}{2}\cos(2\omega t + \theta) \rightarrow {\rm LPF} \rightarrow \frac{A}{2}\cos(\theta) $$ where $\omega$ is the frequency, LPF is Low Pass Filter, $A$ is the amplitude and $\theta$ is the phase difference between the sine waves.

I made a Matlab program to plot this, then I tried with a square wave multiplied with a sine wave. I can see that there is still a connection between DC and phase by doing a FFT as well as in the time domain. I would like to see the math for the relationship between DC and phase.

For sine $\times$ sine, I have read that sampling with a frequency four times the modulated signal frequency will make it possible to get the I and Q values by subtracting samples in the following order:

$$ I(t) = s(t) - s(t-2) $$ $$ Q(t) = s(t-3) - s(t-1) $$ where $$ s(t) = A\sin(\omega t + \theta) $$

This I do not quite understand yet and therefore leads me to be unable to determine if this also is valid for a square $\times$ sine. Can anyone try to explain this to me?

I will appreciate any feedback on how to effectively do IQ demodulation on a micro-controller using a square reference waveform.

Additional information:

I wish to use a micro-controller to sample the analog sine and square (reference) signal and do IQ demodulation. I almost only find information about sine $\times$ sine and therefore want to know if there are any pitfalls using a reference square wave that I am not seeing yet.


So if your sampling rate is four times the modulated signal frequency (and sampling synchronously) then $\omega= \pi/2$. So then $$ \begin{array} II(t) &=& s(t) - s(t-2)\\ &=& A\sin(\pi/2 t + \theta) - A\sin(\pi/2 (t - 2) + \theta)\\ &=& 2A\sin(\pi/2 t + \theta) \end{array} $$ and $$ \begin{array} QQ(t) &=& s(t-3) - s(t-1)\\ &=& A\sin(\pi/2 (t-3) + \theta) - A\sin(\pi/2 (t - 1) + \theta)\\ &=& A\sin(\pi/2 t + \theta - 3\pi/2) - A\sin(\pi/2 t + \theta - \pi/2)\\ &=& 2A \cos((\pi/2 t + \theta - 3\pi/2 + \pi/2 t + \theta - \pi/2)/2) \\ &&\sin((\pi/2 t + \theta - 3\pi/2 - (\pi/2 t + \theta - \pi/2))/2)\\ &=& 2A\cos(\pi/2 t + \theta) \end{array} $$

The trick will be to think about the square wave case, and see what this derivation tells you about that.

  • $\begingroup$ I am not sure what you are asking? Does "I = 2" mean $I(t-2)$ ? $\endgroup$
    – Peter K.
    Apr 9 '13 at 17:03
  • $\begingroup$ I deleted the above comment as I was wrong (and it might be misleading). The algorithm above will not work with a square reference as the sine x square product wave does NOT phase shift the same way as the sine x sine product wave does when reference phase is adjusted. Only way to find I and Q when using square reference as far as I can see is to use a low pass filter and measure the outputs. $\endgroup$ Apr 9 '13 at 21:35
  • 1
    $\begingroup$ @PeterK. It's always good to see a problem worked out explicitly. This is not a "ping" yet, but definitely making progress on IQ - thanks! $\endgroup$
    – uhoh
    Mar 5 '17 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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