Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
% Randomly generate nBit data for each nUser
data=sign(randn(nUser,nBit));
W=Walsh(G);
%generate G random sequence to randomly pick up nUser Walsh code access
rnd_sqn = randperm(G);
W = W(rnd_sqn(1:nUser),;
% W = W((1:nUser),;
%spreading the signal
for i=1:nUser
for j=1:nBit
spread_signal(i,(j-1)*G+1:j*G) = data(i,j).*W(i,;
end
end
%receiving signal
received_signal = sum(spread_signal);
%despread the received signal
for i=1:nUser
for j=1:nBit
despread_signal(i,(j-1)*G+1:j*G) = received_signal(1,(j-1)*G+1:j*G).*W(i,;
end
end
for i=1:nUser
for j=1:nBit
received_data(i,j)=sum(despread_signal(i,(j-1)*G+1:j*G));
end
end
%normalize the received data
received_data=received_data./G;
%plot out the sent/received data for verification
figure;
for i=1:nUser
subplot(nUser,1,i); plot(data(i,);
title(['Base data:user ', num2str(i)]);
end
figure;
for i=1:nUser
subplot(nUser,1,i); plot(received_data(i,);
title(['Received data:user ', num2str(i)]);
end
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.