All problems
QPSK Constellation Mapping
Problem
Map a pair of bits to a Gray-coded QPSK constellation point: 00 -> [1, 1], 01 -> [-1, 1], 11 -> [-1, -1] and 10 -> [1, -1]. Return the two coordinates as a list.
Hint
Gray mapping keeps neighboring constellation points one bit apart.
Test cases
case 1
in: [[0,0]]
expected: [1,1]
case 2
in: [[0,1]]
expected: [-1,1]
case 3
in: [[1,1]]
expected: [-1,-1]
case 4
in: [[1,0]]
expected: [1,-1]
Starter codePython
def qpsk_map(bits):
# Your code here
pass4 test cases · run your code against them in the editor