function x=det_16QAM(I,Q) % x=det_16QAM(I,Q,modulation) % % 16QAM detection % I,Q : input symbols % x : output bit stream % I,Q,x are column vectors. i=sqrt(-1); [m,n]=size(I); if n~=1 error('Input vector I should be a column.'); end [m,n]=size(Q); if n~=1 error('Input vector Q should be a column.'); end scale=sqrt(9/10); I=I/scale; Q=Q/scale; x= kron(I<0,[1 0 0 0].') + kron(I>-2/3 & I<2/3,[0 1 0 0].') + kron(Q<0,[0 0 1 0].') + kron(Q>-2/3 & Q<2/3,[0 0 0 1].');