msg1=[1,-1,1,1,-1,1,1,-1,1]
msg2=[-1,-1,-1,1,1,1,-1,-1,1]
pn1=[1,-1,1,-1,1,-1,1,-1];
pn2=[-1,-1,1,1,-1,-1,1,1];
carrier=sin(linspace(0,1,20)*2*pi*2);
%Spreading
cdma1=reshape((carrier'*reshape(pn1'*msg1,1,8*9)),8*9*20,1);
cdma2=reshape((carrier'*reshape(pn2'*msg2,1,8*9)),8*9*20,1);
%Mixing
cdma=cdma1+cdma2;
%Despreading
de_msg1=int8(pn1*reshape(carrier*reshape(cdma,20,8*9),8,9)/76)
de_msg1=int8(pn2*reshape(carrier*reshape(cdma,20,8*9),8,9)/76)
