Let's assume your original message signal is: 1, 0, 1, 1, 1, 0, 1, 1, 0, 1.
If you want to modulate it using 4-QAM, then your baseband signal will be:
4-QAM Symbols (Real + jImag)
- Symbol 0: -1.00 + j-1.00
- Symbol 1: 1.00 + j-1.00
- Symbol 2: -1.00 + j-1.00
- Symbol 3: 1.00 + j-1.00
- Symbol 4: 1.00 + j1.00
Now, if you want to transmit them through a typical wireless medium, you need to modulate the baseband signal with a carrier frequency (in our case, 50 Hz). The resulting passband signal looks like this
In the above code, the symbol rate is 5 symbols per second.
Detailed explanation
4-QAM Constellation Points
In typical normalized 4-QAM, each symbol is mapped to a complex number:
Bits | Symbol (I + jQ) |
---|---|
00 | -1 - 1j |
01 | -1 + 1j |
11 | +1 + 1j |
10 | +1 - 1j |
Each point lies on a square centered at the origin with I and Q values either +1 or -1.
Magnitude of a Complex Number
For a complex number z = a + jb
, the magnitude is:
|z| = √(a² + b²)
So for a 4-QAM symbol like +1 + j1
:
|+1 + j1| = √(1² + 1²) = √2
All four constellation points have the same magnitude:
√((-1)² + (-1)²) = √2
√((-1)² + (1)²) = √2
√((1)² + (1)²) = √2
√((1)² + (-1)²) = √2
That’s why all 4-QAM symbols have magnitude √2.
In our case magnitude is normalized to 1.
4-QAM Symbols as Complex Numbers
Standard Gray-coded mapping:
Bits | Complex Symbol | Coordinates (I, Q) | Angle (radians) | Angle (degrees) |
---|---|---|---|---|
00 | -1 - j1 | (-1, -1) | −3π/4 | -135° |
01 | -1 + j1 | (-1, +1) | +3π/4 | +135° |
11 | +1 + j1 | (+1, +1) | +π/4 | +45° |
10 | +1 - j1 | (+1, -1) | −π/4 | -45° |
Each point lies at a 45° increment around a circle centered at the origin.
How We Compute the Angle (Phase)
Given a complex number z = a + jb
:
- The angle (also called argument or phase) is:
ϕ = arg(z) = tan⁻¹(b/a)
- In programming, use
atan2(b, a)
to handle all four quadrants correctly.
Examples:
arg(1 + j1) = tan⁻¹(1/1) = π/4 (45°)
arg(−1 + j1) = tan⁻¹(1/−1) = 3π/4 (135°)
arg(−1 − j1) = tan⁻¹(−1/−1) = −3π/4 (−135°)
arg(+1 − j1) = tan⁻¹(−1/1) = −π/4 (−45°)