image thumbnail

CDMA signal on AWGN

by

 

Spreading of single user data information

CDMA_Error_code.m
clc
clear all
close all 
user=1;
nob=100;
chip_bits=8
samp_time=1e-7
samp=1/samp_time 
chip_duration=0.1e-6
bit_duration=chip_duration*chip_bits
chip_samp=chip_duration/samp_time
bit_samp=chip_samp*chip_bits
a=randint(nob,user);
pu_a=rectpulse(a,bit_samp);
figure(1)
subplot(221)
plot(pu_a)
ylim([-0.1 1.1])
h=seqgen.pn;
h.NumBitsOut=chip_bits;
pnseq=generate(h);
pu_pnseq=rectpulse(pnseq,chip_samp);
pu_pnseq1=repmat(pu_pnseq,nob,1);
figure(1)
subplot(222)
plot(pu_pnseq1)
ylim([-0.1 1.1])
mul=xor(pu_a,pu_pnseq1);
figure(1)
subplot(223)
plot(mul)
ylim([-0.1 1.1])
mul1=awgn(double(mul),1,'measured')
figure(1)
subplot(224)
plot(mul1)
ylim([-0.5 1.5])
rx=mul1>0.5;
rxsym=xor(rx,pu_pnseq1);
rxa=intdump(double(rxsym),bit_samp);
rxa=round(rxa);
ber=biterr(a,rxa);
msgbox(num2str(ber))

Contact us