0% found this document useful (0 votes)
16 views

CD Ma

This document summarizes the steps to spread, modulate, transmit, and receive a digital signal for a single user. It generates random data for user 1, spreads the data using a Hadamard code, performs BPSK modulation, transmits the signal with AWGN noise, uses an adaptive filter for noise cancellation, demodulates and despreads the signal, and displays the output data bits along with the error rate. Key steps include: 1) Generating random data, spreading with a Hadamard code, and BPSK modulating the spread signal for transmission. 2) Adding AWGN noise to the transmitted signal and using an adaptive filter to perform noise cancellation. 3) Demodulating the signal, averaging

Uploaded by

Joy Bhadhan Roy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

CD Ma

This document summarizes the steps to spread, modulate, transmit, and receive a digital signal for a single user. It generates random data for user 1, spreads the data using a Hadamard code, performs BPSK modulation, transmits the signal with AWGN noise, uses an adaptive filter for noise cancellation, demodulates and despreads the signal, and displays the output data bits along with the error rate. Key steps include: 1) Generating random data, spreading with a Hadamard code, and BPSK modulating the spread signal for transmission. 2) Adding AWGN noise to the transmitted signal and using an adaptive filter to perform noise cancellation. 3) Demodulating the signal, averaging

Uploaded by

Joy Bhadhan Roy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

clear all

k=6; %no of bits


x=randint(1,k);
data4user1=2*x-1
sf=4;
code=hadamard(sf);
code4user1=code(4,:)
spreadsig=kron(data4user1,code4user1)
r=spreadsig;
r1=reshape(r,length(r)/k,k)
r2=r1'
for i= 1:k
y(i)=sum(r2(i,:).*code4user1)/sf;
end
output=y
.....................with awgn.....................
tb=1e-03;
tc= tb/sf;

t=linspace(0,tb,50);
z=rectpuls(t);
z1=[];
t1=[];
for i=1:length(data4user1)
z1 = [ z1 data4user1(i)*z]; % for line coding
t1=[t1 t+(i-1)*t(end) ];
end
stairs (t1,z1);
ylim([-2 2]);%...................represent data bit
t2=linspace(0,tc,50);
z2=rectpuls(t2);
z3=[];
t3=[];
for i=1:length(spreadsig)
z3 = [z3 spreadsig(i)*z2]; % for line coding
t3= [t3 t2+(i-1)*t2(end)];
end
stairs (t3,z3);
ylim([-2 2]); %..............represent spreaded signal

fc=1/tc;
carrier= cos(2*pi*fc*t3);
plot(t3,carrier);
out1= z3.*carrier; %........... bpsk modulation
plot(t3,out1);

r= awgn(out1,-10);
plot(t3,r);

noise= r-out1;
go=sqrt(.1)*eye(64);
ha=adaptfilt.qrdrls(64,0.99,go);
[d e] =filter(ha,0.01*noise,r);
plot(t3,e);

noise2= e-out1;
[d1 e1]=filter(ha,0.01*noise2,e);
plot(t3,e1);

m=zeros(1,length(e1));

for i=1:3

m=m+[zeros(1,i-1) e(i:length(e))];
end
M=m/3;
plot(t3,M)

r1=M.*carrier;
plot(t3,r1);
y1=[];
for i=1:50:length(r1) %........... sampling for acuiring spreaded bit
sequence
y1 =[ y1 r1(i)];
end
y2=reshape(y1,length(y1)/k,k)';
for i=1:k
y3(i) =sum(y2(i,:).*code4user1)/sf;
end
for i=1:length(y3)
if y3(i)<0

y4(i)=-1;
else y4(i)=1;
end
end

% ...................ouput bit display...........

tbit=linspace(0,tb,50);
z=rectpuls(t);
z1=[];
t4=[];
for i=1:length(y4)
z1 = [ z1 y4(i)*z]; % for line coding
t4=[t4 tbit+(i-1)*tbit(end)];
end
stairs(t4,z1);ylim([-2 2]);

data1=(data4user1+1)/2;
output=(y4+1)/2;error=biterr(data1,output);
disp(error);
%
%

You might also like