Matlab simulation for the uplink and downlink in CDMA

Status
Not open for further replies.

Roshdy

Member level 3
Joined
Nov 23, 2005
Messages
57
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Location
Egypt
Activity points
1,738
CDMA simulation

I need the matlab simulation for the uplink and downlink in CDMA
 

Re: CDMA simulation

clear all;
nUser = 8;
nBit = 10;
G = 64;

% 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
 

    Roshdy

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…