X hits on this document

# DigitalCommons@University of Nebraska - Lincoln - page 67 / 69

202 views

0 shares

67 / 69

58

BitsTx=BitsTx+1; %increment bits transmitted

b(data_reg_ct)=(2*round(rand(1))-1);% Generate the next bit to

%be transmitted t_sig=[b(data_reg_ct)*s_sig];% Multiply the pattern with the %g_sig = awgn(t_sig,-(SNR-3),0); %with spreading signal %fade=sqrt(randn^2+randn^2)/sqrt(2); %rchan sig=fade*t sig+(1/sqrt(2*10^(SNR1/10))*randn(1,ch bt)*sqrt(ch bt));

_

_

_

_

j sig

_

_ = g sig; %jamming signal = transmitted signal %when no jamming present, or chip not jammed

%------ Adding the jamming signal, jamming done on chip level for i=1:length(j_sig) if (floor(rand(1)+jdc)==1) %jdc percent chance of jamming j_sig(i) = j_sig(i) + wgn(1,1,(SNR-3))*(1/sqrt(jdc)); end

end

d a t a _ r e g ( d a t a _ r e g _ c t , : ) = j _ s i g spread_reg(data_reg_ct,:) = ds_sig; ;

if data reg ct > 1

_

_

s sig=circshift(s sig,[1,1]); %rotates in a 0

_ _ s sig(1)=b(data reg ct); _ _ _

%and sets a new 1st bit

ds sig=circshift(ds sig,[1,1]); %rotates in a 0

_

_

ds sig(1)=b(data reg ct);

%and sets a new 1st bit

_

_

_

data reg ct = data reg ct - 1;

_

_

_

_

else

n= ch_bt+1; %-----------Bit Decision for n=1:ch_bt if dot(spread reg((ch bt+2)-n,:),data reg((ch bt+2)-n,:)) < 0 bit = -1; else bit = 1; end %n=1:(4,1),(3,2),(2,3),(1,4) for p=1:ch_bt+1-n % n=2:(3,1),(2,2),(1,3) spread_reg((ch_bt+2)-(p+n),p) = bit; end if(dot(spread reg((ch bt+1)-n,:),data reg((ch bt+1-n),:))<0) _ _ _ _

_

_

_

_

bit2 = -1; else

bit2 = 1; end temp(n) = data reg((ch bt+1)-n,n)

• *

bit2;

_

_

end

d sig = dot(data reg(ch bt+1,:),spread reg(ch bt+1,:)) + sum(temp);

_

_

_

_

_

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - C h i p D e c i s i o n - - - - - - - - - - - - - - - - - - - - - - - - - - - -

% % % % % %

for n=1:ch_bt

if dot2(spread reg((ch bt+2)-n,:),data reg((ch bt+2)-n,:)) < 0

_

_

_

_

bit = -1; else

bit = 1;

%

end

 Document views 202 Page views 202 Page last viewed Mon Jan 16 11:19:58 UTC 2017 Pages 69 Paragraphs 1770 Words 13793