I am trying to model CDMA in Matlab for a few hundred users to compare it with other multiple access schemes. Every time the script runs, first a data frame is created with this line:
User = sign(randn([NumberOfUsers,BitsPerFrame]));
And then I am using the comm.GoldSequence object to generate the necessary Gold codes for the spreading. The code is taken from the example from the manual, the only change being that the First and Second Polynomials are different:
for i=1:NumberOfUsers
code=[];
k=de2bi(i,9);
hgld = comm.GoldSequence('FirstPolynomial',[9 4 0],...
'SecondPolynomial', [9 6 4 3 0],...
'FirstInitialConditions', [k],...
'SecondInitialConditions', padarray(1,4)',...
'Index', 4, 'SamplesPerFrame', CodeLength);
code = step(hgld)';
for t= 1:length(code)
if code(t)==0
code(t)=-1;
end
end
code_matrix(i,:)=code;
end
The system works as expected when the number of users are a few tens. However when the users reach the hundreds the BER rate is almost 50%, which has to be wrong. I don't really see why though, since the Gold codes are generated correctly as far as I can tell. Any help would be greatly appreciated.