def QAM_bb(N_symb,Ns,mod_type='<STR_LIT>',pulse='<STR_LIT>',alpha=<NUM_LIT>):
<EOL>if pulse.lower() == '<STR_LIT:src>':<EOL><INDENT>b = sqrt_rc_imp(Ns,alpha,<NUM_LIT:6>)<EOL><DEDENT>elif pulse.lower() == '<STR_LIT>':<EOL><INDENT>b = rc_imp(Ns,alpha,<NUM_LIT:6>)    <EOL><DEDENT>elif pulse.lower() == '<STR_LIT>':<EOL><INDENT>b = np.ones(int(Ns)) <EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:2> <EOL><DEDENT>elif mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:4><EOL><DEDENT>elif mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:8><EOL><DEDENT>elif mod_type.lower() == '<STR_LIT>':<EOL><INDENT>M = <NUM_LIT:16><EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>xI = np.random.randint(<NUM_LIT:0>,M,N_symb)<EOL>xI = <NUM_LIT:2>*xI - (M-<NUM_LIT:1>)<EOL>xQ = np.random.randint(<NUM_LIT:0>,M,N_symb)<EOL>xQ = <NUM_LIT:2>*xQ - (M-<NUM_LIT:1>)<EOL>symbI = np.hstack((xI.reshape(N_symb,<NUM_LIT:1>),np.zeros((N_symb,int(Ns)-<NUM_LIT:1>))))<EOL>symbI = symbI.flatten()<EOL>symbQ = np.hstack((xQ.reshape(N_symb,<NUM_LIT:1>),np.zeros((N_symb,int(Ns)-<NUM_LIT:1>))))<EOL>symbQ = symbQ.flatten()<EOL>symb = symbI + <NUM_LIT>*symbQ<EOL>if M > <NUM_LIT:2>:<EOL><INDENT>symb /= (M-<NUM_LIT:1>)<EOL><DEDENT>x = signal.lfilter(b,<NUM_LIT:1>,symb)<EOL>x = x.flatten() <EOL>b = b/sum(b)<EOL>return x, b, xI+<NUM_LIT>*xQ<EOL>
QAM_BB_TX: A complex baseband transmitter 
x,b,tx_data = QAM_bb(K,Ns,M)

//////////// Inputs //////////////////////////////////////////////////
  N_symb = the number of symbols to process
      Ns = number of samples per symbol
mod_type = modulation type: qpsk, 16qam, 64qam, or 256qam
   alpha = squareroot raised codine pulse shape bandwidth factor.
           For DOCSIS alpha = 0.12 to 0.18. In general alpha can 
           range over 0 < alpha < 1.
     SRC = pulse shape: 0-> rect, 1-> SRC
//////////// Outputs /////////////////////////////////////////////////
       x = complex baseband digital modulation
       b = transmitter shaping filter, rectangle or SRC
 tx_data = xI+1j*xQ = inphase symbol sequence + 
           1j*quadrature symbol sequence

Mark Wickert November 2014