I and Q components and the difference between QPSK and 4QAM

Both 4QAM and QPSK apparently produce the same waveform, but are they the same mathematically?

In a QPSK constellation, are the mapping points at 45, 135, 225 and 315 degrees while the 4QAM is at 0, 90, 180 and 270?

I also struggle to understand the I/Q components of such a constellation diagram. What does "inphase" and "quadrature-phase" actually mean? Are they just another way to specify the real and imaginary part for this type of usage?

-

Both QPSK and $4$-QAM constellations have signal points at $45, 135, 225$, and $315$ degrees (note typo in your question). They arise from amplitude modulation (or, if you prefer, phase modulation) of two carrier signals (called the inphase and quadrature carriers) that are orthogonal (meaning that they differ in phase by 90 degrees. The canonical representation of a QPSK or $4$-QAM signal during one symbol interval is $$s(t) = (-1)^{b_I}\cos(2\pi f_c t) - (-1)^{b_Q}\sin(2\pi f_c t)$$ where $\cos(2\pi f_c t)$ and $-\sin(2\pi f_c t)$ are the inphase and quadrature carrier signals at frequency $f_c$ Hz and $b_I, b_Q \in \{0,1\}$ are the two data bits (called the inphase and quadrature data bits, naturally, since they are transmitted on the inphase and quadrature carriers). Notice that the inphase carrier $\cos(2\pi f_c t)$ has amplitude $+1$ or $-1$ according as the inphase data bit has value $0$ or $1$, and similarly the quadrature carrier $-\sin(2\pi f_c t)$ has amplitude $+1$ or $-1$ according as the quadrature data bit has value $0$ or $1$. Some people regard this as an inversion of the normal scheme of things, didactically asserting that positive amplitudes must be associated with $1$ data bits and negative amplitudes with $0$ bits. But if we look at it from the phase modulation perspective, a $0$ bit means that the carrier ($\cos(2\pi f_c t)$ or $-\sin(2\pi f_c t)$ as the case may be) is transmitted with no change in phase while a $1$ data bit creates a change in phase (we will think of it as a phase delay) of $180$ degrees or $\pi$ radians. Indeed, another way of expressing the QPSK/$4$-QAM signal is as $$s(t) = \cos(2\pi f_c t - b_I\pi) - \sin(2\pi f_c t - b_Q\pi)$$ which makes the phase modulation viewpoint very clear. But, regardless of which viewpoint we use, during a symbol interval, the QPSK/$4$-QAM signal is one of the following four signals: $$\sqrt{2}\cos\left(2\pi f_c t + \frac{\pi}{4}\right), ~ \sqrt{2}\cos\left(2\pi f_c t + \frac{3\pi}{4}\right), ~ \sqrt{2}\cos\left(2\pi f_c t + \frac{5\pi}{4}\right), ~\sqrt{2}\cos\left(2\pi f_c t + \frac{7\pi}{4}\right)$$ corresponding to $(b_I,b_Q) = (0,0), (1,0), (1,1), (0,1)$ respectively.

Note that the viewpoint taken here is of QPSK as consisting of two BPSK signals on phase-orthogonal carriers. The demodulator thus consists of two BPSK receivers (called the inphase branch and quadrature branch, what else?). An alternative view of QPSK as changing the phase of a single carrier depending on a $4$-valued symbol is developed a little later.

The QPSK/$4$-QAM signal can also be expressed as $$s(t) = \text{Re}\{B \exp(j2\pi f_c t)\} = \text{Re}\{[(-1)^{b_I}+j(-1)^{b_Q}] \exp(j2\pi f_c t)\}$$ where $B$ is the complex-valued baseband symbol taking on values in $\{\pm 1 \pm j\}$ and which, when plotted on the complex plane, gives constellation points distant $\sqrt{2}$ from the origin and at $45, 135, 225$, and $315$ degrees corresponding to data bits $(b_I,b_Q) = (0,0), (1,0), (1,1), (0,1)$ respectively. Note that the bits naturally occur around the circle in Gray code order; there is no need to massage a given data bit pair $(b_0,b_1)$ from "natural representation" to "Gray code representation" as some implementations seem to insist on doing. Also, complementary bit pairs lie diagonally across the circle from each other (that is, a double bit error is less likely than a single bit error).

If we delay the four possible signals exhibited above by $45$ degrees or $\pi/4$ radians we get $$\sqrt{2}\cos\left(2\pi f_c t + \frac{\pi}{4}\right), ~ \sqrt{2}\cos\left(2\pi f_c t + \frac{3\pi}{4}\right), ~ \sqrt{2}\cos\left(2\pi f_c t + \frac{5\pi}{4}\right), ~\sqrt{2}\cos\left(2\pi f_c t + \frac{7\pi}{4}\right)\\ \Bigr\Downarrow\\ \sqrt{2}\cos\left(2\pi f_c t + 0\frac{\pi}{2}\right), ~ \sqrt{2}\cos\left(2\pi f_c t + \frac{\pi}{2}\right), ~ \sqrt{2}\cos\left(2\pi f_c t + 2\frac{\pi}{2}\right), ~\sqrt{2}\cos\left(2\pi f_c t + 3\frac{\pi}{2}\right)\\ \Bigr\Downarrow\\ \sqrt{2}\cos(2\pi f_c t), ~ -\sqrt{2}\sin(2\pi f_c t), ~ -\sqrt{2}\cos(2\pi f_c t), ~\sqrt{2}\sin(2\pi f_c t)$$ which give the four constellation points at $0,90,180,270$ degrees referred to by the OP. This form gives us another way of viewing QPSK signaling: a single carrier signal whose phase takes on four values depending on the input symbol which takes on values $\{0,1,2,3\}$. We express this in tabular form. $$\begin{array}{|c|c|c|c|c|c|c|} \hline (b_I,b_Q) & \text{normal value} ~k & \text{Gray code value} ~\ell & \text{signal as abive} &\text{phase-modulated signal}\\ \hline (0,0) & 0 & 0 & \sqrt{2}\cos(2\pi f_c t) & \sqrt{2}\cos\left(2\pi f_c t - 0\frac{\pi}{2}\right)\\ (0,1) & 1 & 1 & \sqrt{2}\sin(2\pi f_c t) & \sqrt{2}\cos\left(2\pi f_c t - 1\frac{\pi}{2}\right)\\ (1,1) & 3 & 2 & -\sqrt{2}\cos(2\pi f_c t) & \sqrt{2}\cos\left(2\pi f_c t - 2\frac{\pi}{2}\right)\\ (1,0) & 2 & 3 & -\sqrt{2}\sin(2\pi f_c t) & \sqrt{2}\cos\left(2\pi f_c t - 3\frac{\pi}{2}\right)\\ \hline \end{array}$$ That is, we can regard the QPSK modulator as having input $(b_I,b_Q)$ that it regards as the Gray code representation of the integer $\ell \in \{0,1,2,3\}$ and produces the output $$\sqrt{2}\cos\left(2\pi f_c t - \ell\frac{\pi}{2}\right).$$ In other words, the phase of carrier $\sqrt{2}\cos(2\pi f_c t)$ is modulated (changed from $0$ to $\ell\frac{\pi}{2}$) in response to the input $\ell$.

So how does this work in real life or MATLAB, whichever comes first? If we define a QPSK signal as having value $\sqrt{2}\cos\left(2\pi f_c t - \ell\frac{\pi}{2}\right)$ where the value of $\ell$ is typed in as 0 or 1 or 2 or 3, we will get the QPSK signal described above, but the demodulator will produce the bit pair $(b_I, b_Q)$ and we must remember that the output is $\ell$ in Gray code interpretation, that is, the demodulator output will be $(1,1)$ if $\ell$ happened to have value $2$, and interpreting output $(1,1)$ as $3$ is a decoding error that is not generally discussed in textbooks!

-
This is the most incredible answer I have ever gotten at SE! Even though I see I have a lot to wrap my mind around, thank you very much! Amazing... –  Wilhelmsen Jan 9 '13 at 10:21
My hat's off to Dilip for his fantastic answer. On a purely practical note however, if you were to write a receiver for 4QAM and QPSK, and you have to correct for an arbitrary phase offset, it should be clear that the physical layer receiver for one will work as a physical layer receiver for the other. Also - again, not to diminish Dilip's answer, but the simplest explanation of how IQ can relate to real-valued samples is here –  Dave C Jan 30 '13 at 20:09
@Dilip Sarwate Excellent answer. Just one doubt, can i assume that QPSK can be achieved by two ways. First one being just amplitude modulating and sending on I and Q channels or second way by only phase modulating the signal by -lpi/2 where l={0,1,2,3}. So you needn't do a combination of both amplitude and phase modulation. Am I right in believing that i need to do both amplitude and phase modulation together to achieve higher orders of QAM like 16-QAM and 64-QAM? –  Talasila Dec 13 '13 at 14:37
In practice, QPSK is almost universally achieved in just one way: antipodal BPSK on the I and Q carriers, and it results in 4-QAM. You can view it as phase modulation if you like but antipodal BPSK is the same as $2$-PAM or amplitude modulation and nobody uses a general-purpose $M$-ary phase modulation circuit (or DSP software subroutine) with $M$ set to $2$ for this purpose. In practice, $2^{2m}$-QAM is achieved by $2^m$-PAM on the I and Q carriers and no phase modulation is used. Note that for $m > 1$, the PAM cannot be viewed (except by extreme nitpickers) as phase modulation either. –  Dilip Sarwate Dec 13 '13 at 15:39
@Talasila The A in QAM stands for amplitude. –  Dilip Sarwate Dec 14 '13 at 2:48

Both are the same. QPSK can be considered as a special case of QAM.

-
Hey, welcome to DSP! While we're glad you're contributing, it is usually encouraged for people to include some details in their answers and clarify their reasoning. In that way, the OP can not only get the answer, but also learn something. It would be nice if you edited your question and added some more detail. –  penelope Dec 12 '13 at 9:14