Definitioncore
Offset QPSK
Also called OQPSK, staggered QPSK.
QPSK with the quadrature stream delayed by half a symbol, so the phase never jumps by 180 degrees and the envelope of the filtered signal stays away from zero.
Offset QPSK (OQPSK) is QPSK in which the quadrature component is delayed by half a symbol period against the in-phase component. The two components then never change at the same instant, so the phase of the signal moves by at most degrees at a time and never by degrees. After a band-limiting filter, the envelope of QPSK falls close to zero at each degree step, while the envelope of OQPSK stays well away from zero. This matters when a nonlinear amplifier would otherwise spread the filtered spectrum again. The spectrum and the error rate in white noise are the same as for QPSK.
Definition
Let be the symbol period, a real pulse with unit energy, and let the bits be grouped in pairs . Map them to the levels and , so that each symbol has energy and each bit . The offset QPSK signal in complex baseband is
where is the imaginary unit. On a carrier of frequency it is . Plain QPSK is the same formula without the delay ; it is PSK with points at the phases .
Properties.
- No 180 degree steps. With a rectangular pulse of length , the in-phase level can change only at and the quadrature level only at . At each instant only one sign flips, which moves the point to a neighbor at degrees. In QPSK both signs can flip at once, which moves the point to the opposite side: a degree step through the origin.
- The envelope after filtering. With a smooth pulse, such as a root-raised-cosine filter, a degree step of QPSK makes the signal pass near . In OQPSK one component is at its peak while the other changes, so the envelope stays away from and varies less. A smaller range of the envelope means less regrowth of the spectrum in a nonlinear amplifier.
- Same spectrum. The two components carry independent data, so the power spectral density is the sum of theirs, and a delay of one component does not change its spectrum. OQPSK has the spectrum of QPSK with the same pulse: up to a constant.
- Same error rate. The receiver applies the matched filter and samples the in-phase part at and the quadrature part at , each after the delay of the filters. With a pulse whose matched pair is a Nyquist pulse, each component is a binary decision in white noise, and the bit error rate is , as for QPSK, with the Gaussian Q function.
- Constant envelope with a half-sine pulse. With on , the two components satisfy at every instant, and the signal has a constant amplitude. This is minimum-shift keying, whose bit period is .
The modulator and the receiver
OQPSK-MODULATE(b_0, ..., b_{2N-1}, g, L_s) ▷ L_s even, g the taps of the pulse at L_s per T- 1
a_I[k] ← (1 - 2 b_{2k})/√2, a_Q[k] ← (1 - 2 b_{2k+1})/√2 - 2
s ← Σ_k a_I[k] · g shifted by k·L_s samples - 3
s ← s + j · Σ_k a_Q[k] · g shifted by k·L_s + L_s/2 samples ▷ the offset of T/2 - 4
return s OQPSK-RECEIVE(r, g, L_s, N)- 5
z ← r filtered with the time-reversed taps of g; D ← len(g) - 1 - 6
b̂_{2k} ← [Re z[k·L_s + D] < 0] - 7
b̂_{2k+1} ← [Im z[k·L_s + L_s/2 + D] < 0] ▷ the quadrature part, half a symbol later - 8
phase step between the middles of two half-symbol intervals: arg(s[m′] · conj(s[m]))
The tests build both signals with a rectangular pulse and with an RRC pulse at , check that OQPSK has only steps of and degrees while QPSK also has steps of degrees, check the envelope numbers below, and recover the bits through the matched filter.
Examples and non-examples
A sequence by hand. Take the bit pairs . The levels (times ) are and . In QPSK the point goes from to at : a degree step. In OQPSK, at only changes, to , a degree step; at the part changes, to , another degree step. At the part stays at , and at the part changes to : one more step of degrees.
Envelope with RRC pulses. With , , filters of symbols on each side, and random symbols (seed in the tests), the envelope of QPSK ranges from to times its rms value, and the envelope of OQPSK from to times its rms value. The peaks hardly change; the deep dips of QPSK are gone.
Where it is used. The 2.4 GHz physical layer of IEEE 802.15.4 sends OQPSK with half-sine pulses, which is MSK in another form. The reverse link of IS-95 CDMA used OQPSK so that the handset amplifier could run close to saturation.
Non-example: pi/4-QPSK. This scheme alternates between two QPSK constellations rotated by degrees, so that every step is or degrees. It also avoids the step through the origin, but both components change at the same instants and there is no offset in time. It is often detected differentially, as in differential phase-shift keying.
Non-example: offset 16-QAM. Delaying the quadrature part of 16-QAM by (offset QAM) keeps the data rate, but the levels of each component still pass near zero, so the gain in envelope is smaller. It is used in filter-bank multicarrier systems for reasons of orthogonality, not for the envelope.
Related definitions
- Phase-shift keying and QAM: QPSK is 4-PSK and 4-QAM; OQPSK is the same constellation with staggered timing.
- Minimum-shift keying: OQPSK with a half-sine pulse of length , two bit periods, a form of continuous-phase modulation with a constant envelope.
- Pulse shaping and the root-raised-cosine filter: the usual pulse; the offset does not change the matched filter.
- Peak-to-average power ratio: the measure of the envelope that OQPSK improves at the low end.
Code
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/offset-qpsk/. The authors are listed in prov/HPEG9T.jsonl.
"""Offset QPSK at L_s samples per symbol: the modulator, the matched-filter receiver, and the
phase steps of the signal.
Bits 2k and 2k+1 give the in-phase and quadrature levels (1 - 2b)/sqrt(2), so E_s = 1 for a
pulse whose taps have unit energy. offset=False gives plain QPSK with the same pulse, for comparison.
L_s must be even, so that the offset of T/2 is L_s/2 samples.
"""
import math
def rrc_taps(beta: float, ls: int, span: int) -> list[float]:
"""Root-raised-cosine taps g(n/ls), |n| <= span*ls, T = 1, scaled to unit energy."""
g = []
for n in range(-span * ls, span * ls + 1):
u = n / ls
if u == 0:
v = 1 - beta + 4 * beta / math.pi
elif abs(abs(4 * beta * u) - 1) < 1e-12:
a = math.pi / (4 * beta)
v = beta / math.sqrt(2) * ((1 + 2 / math.pi) * math.sin(a) + (1 - 2 / math.pi) * math.cos(a))
else:
v = (math.sin(math.pi * (1 - beta) * u) + 4 * beta * u * math.cos(math.pi * (1 + beta) * u)) / (
math.pi * u * (1 - (4 * beta * u) ** 2)
)
g.append(v)
e = math.sqrt(sum(v * v for v in g))
return [v / e for v in g]
def levels(bits: list[int]) -> tuple[list[float], list[float]]:
"""The in-phase and quadrature levels of each symbol."""
if len(bits) % 2:
raise ValueError("need an even number of bits")
s = 1 / math.sqrt(2)
a_i = [(1 - 2 * b) * s for b in bits[0::2]] # @line L1
a_q = [(1 - 2 * b) * s for b in bits[1::2]]
return a_i, a_q
def modulate(bits: list[int], taps: list[float], ls: int, offset: bool = True) -> list[complex]:
"""sum_k a_I[k] g(t - kT) + j sum_k a_Q[k] g(t - kT - T/2), at ls samples per T."""
if ls % 2:
raise ValueError("ls must be even")
a_i, a_q = levels(bits)
off = ls // 2 if offset else 0
out = [0j] * (len(a_i) * ls + len(taps) + off)
for k, (x, y) in enumerate(zip(a_i, a_q)):
for n, h in enumerate(taps):
out[k * ls + n] += x * h # @line L2
out[k * ls + off + n] += 1j * y * h # @line L3
return out # @line L4
def demodulate(r: list[complex], taps: list[float], ls: int, nsym: int, offset: bool = True) -> list[int]:
"""Matched filter, then I at kT and Q at kT + T/2 (after the delay of the two filters)."""
off = ls // 2 if offset else 0
d = len(taps) - 1
def matched(m: int) -> complex:
# The output at sample m of r filtered with the time-reversed taps.
return sum(r[m - d + n] * h for n, h in enumerate(taps) if 0 <= m - d + n < len(r)) # @line L5
bits = []
for k in range(nsym):
bits.append(1 if matched(k * ls + d).real < 0 else 0) # @line L6
bits.append(1 if matched(k * ls + off + d).imag < 0 else 0) # @line L7
return bits
def phase_steps(s: list[complex], ls: int, start: int, count: int) -> list[float]:
"""Phase change in degrees between the middles of consecutive half-symbol intervals."""
half = ls // 2
mids = [s[start + m * half + half // 2] for m in range(count)]
steps = []
for p, q in zip(mids, mids[1:]):
d = math.degrees(math.atan2((q * p.conjugate()).imag, (q * p.conjugate()).real)) # @line L8
steps.append(d)
return steps
test_offset_qpsk.py 79 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/offset-qpsk/. The authors are listed in prov/HPEG9T.jsonl.
import math
import random
from offset_qpsk import demodulate, levels, modulate, phase_steps, rrc_taps
LS = 8
def random_bits(seed: int, n: int) -> list[int]:
rng = random.Random(seed)
return [rng.randrange(2) for _ in range(n)]
def test_levels() -> None:
a_i, a_q = levels([0, 1, 1, 1])
s = 1 / math.sqrt(2)
assert a_i == [s, -s] and a_q == [-s, -s]
assert all(abs(complex(x, y)) == 1.0 or abs(abs(complex(x, y)) - 1) < 1e-15 for x, y in zip(a_i, a_q))
def test_rectangular_oqpsk_never_jumps_by_180_degrees() -> None:
bits = random_bits(1, 400)
s = modulate(bits, [1.0] * LS, LS, offset=True)
nsym = len(bits) // 2
# Between T/2 and the end of the last I pulse both branches are on, and |s| = 1.
body = s[LS // 2 : nsym * LS]
assert max(abs(abs(v) - 1) for v in body) < 1e-12
steps = phase_steps(s, LS, LS // 2, 2 * nsym - 2)
assert all(min(abs(d), abs(abs(d) - 90)) < 1e-9 for d in steps)
assert any(abs(abs(d) - 90) < 1e-9 for d in steps)
def test_rectangular_qpsk_has_180_degree_jumps() -> None:
bits = random_bits(1, 400)
s = modulate(bits, [1.0] * LS, LS, offset=False)
steps = phase_steps(s, LS, 0, len(bits) - 1)
assert any(abs(abs(d) - 180) < 1e-9 for d in steps)
assert all(min(abs(d), abs(abs(d) - 90), abs(abs(d) - 180)) < 1e-9 for d in steps)
def test_envelope_with_rrc_pulses() -> None:
# beta = 0.5, ls = 8, span 8, seed 7, 1500 symbols: QPSK passes near zero, OQPSK does not.
taps = rrc_taps(0.5, LS, 8)
bits = random_bits(7, 3000)
ratios = {}
for offset in (False, True):
s = modulate(bits, taps, LS, offset)
env = [abs(v) for v in s[len(taps) + 50 * LS : (1500 - 50) * LS]]
rms = math.sqrt(sum(e * e for e in env) / len(env))
ratios[offset] = (min(env) / rms, max(env) / rms)
assert ratios[False][0] < 0.05
assert ratios[True][0] > 0.4
assert ratios[True][1] < ratios[False][1]
def test_matched_filter_round_trip() -> None:
taps = rrc_taps(0.35, LS, 8)
bits = random_bits(3, 400)
for offset in (False, True):
r = modulate(bits, taps, LS, offset)
assert demodulate(r, taps, LS, len(bits) // 2, offset) == bits
def test_no_isi_at_the_sampling_instants() -> None:
taps = rrc_taps(0.35, LS, 8)
bits = random_bits(4, 200)
a_i, a_q = levels(bits)
r = modulate(bits, taps, LS, True)
d = len(taps) - 1
for k in range(20, 80):
zi = sum(r[k * LS + n] * h for n, h in enumerate(taps))
zq = sum(r[k * LS + LS // 2 + n] * h for n, h in enumerate(taps))
# The truncated filters leave a residual ISI below 1% of the level 1/sqrt(2).
assert abs(zi.real - a_i[k]) < 5e-3
assert abs(zq.imag - a_q[k]) < 5e-3
assert d == 128
References
- Steven A. Gronemeyer and Alan L. McBride, MSK and offset QPSK modulation, IEEE Transactions on Communications 24(8), 1976, pp. 809 to 820 (offset QPSK and MSK as the same structure with a rectangular and a half-sine pulse, their spectra, and their behavior after band limiting and a hard limiter)
- John G. Proakis and Masoud Salehi, Digital Communications, fifth edition, McGraw-Hill, 2008, Chapter 3 (digital modulation schemes, including offset QPSK and its relation to MSK)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag HPEG9T Edit this page History Report an error Markdown