function a = qam(M,S)

rootM=sqrt(M);
a=(1/sqrt(2))*(pam(rootM,S)+i*pam(rootM,S));
