# Bits - symbols mapping in M-PAM beginner question

I am trying to implement a M-PAM modulator in Matlab without using the built-in functions. I am confused when it comes to the symbols-bits mapping.

Say I have a sequence of bits: 1000110110 and M = 4 which means I encode k = log2(M) bits into each symbol. So, I get the vector s = [2 0 3 1 2]. But to my understanding this is not the proper mapping because the symbols arent symmetrical e.g. 1,-1,2,-2,3,-3. However, in functions like pammod I see examples that produce the symbols with randi that gives the first kind of mapping. Then, the mapping is passed as an argument in pammod. That is really odd for me since later on the amplitude per symbol is computed using the symmetrical mapping like (2m - M - 1)A (2m - M - 1 produces symmetrical symbols) where A is an energy constant and m = 1,2,3...,M.

So is it ok to use the first mapping when computing the Am amplitude but its less viable? Or I am misunderstanding the concept?

$2^k$-ary PAM maps $k$ bits (which can be expressed as integers in the range $[0, 2^k-1]$ to $2^k$ levels that are equally-spaced and symmetric about $0$. ($0$ is NOT one of the levels).. The levels are odd integers, and so for $k=2$, the levels are $-3, -1, +1, +3$ which are equally spaced and symmetric about $0$. As to which integer in $[0,2^k-1]$, there are several common conventions such as: \begin{align} 00 &\to -3\\ 01 &\to -1\\ 11 &\to +1\\ 10 &\to +3 \end{align} or \begin{align} 00 &\to -3\\ 10 &\to -1\\ 11 &\to +1\\ 01 &\to +3 \end{align} or \begin{align} 10 &\to -3\\ 11 &\to -1\\ 01 &\to +1\\ 00 &\to +3 \end{align} etc. In all cases, there is a one-bit change in going from one level to the next. Note also that your formula $2m-M-1, m = 1,2,\ldots, M$ corresponds to the first list if you assume that $m-1$ is expressed as a $\log_2M$-bit integer and expressed in Gray code so that adjacent symbols differ in only one of the $\log_2M$ bits.