X hits on this document

PDF document

DigitalCommons@University of Nebraska - Lincoln - page 68 / 69

166 views

0 shares

0 downloads

0 comments

68 / 69

% % % % % % % % % % % % % %

59

for p=1:ch_bt+1-n %n=1:(4,1),(3,2),(2,3),(1,4)

%n=2:(3,1),(2,2),(1,3) spread_reg((ch_bt+2)-(p+n),p) = bit; end if(dot2(spread reg((ch bt+1)-n,:),data reg((ch bt+1-n),:))<0)

_

_

_

_

bit2 = -1; else

bit2 = 1; end

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

_

_

end

d _ s i g = d o t 2 ( s p r e a d _ r e g ( c h _ b t + 1 , : ) , d a t a _ r e g ( c h _ b t + 1 , : ) ) + s u m ( t e m p ) ;

if d_sig>0 %gets value for decoded bit

cd_sig=1; else

cd sig=-1; end _

i f ( b ( c h _ b t + 1 ) ~ = c d _ s i g ) % b i t t r a n s m i t t e d i s ! = d e c o d e d b i Errors=Errors+1; end t

%-------------- Progress Bar for Matlab Window ------------

if(mod(BitsTx,Bits2Tx/10) == 0) fprintf('.'); end

%---------------- Update Spread Sequence ------------------

for j=1:ch bt spread reg(j,(ch bt+1)-j) = cd sig; end _ _ _ _

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

_ _ s sig(1)=b(1);

_

%bit, and sets a new 1st bit

%change the self encoded part of the spreading codes

d s _ s i g = c i r c s h i f t ( d s _ s i g , [ 1 , 1 ] ) ds_sig(1)=cd_sig; ;

for m=0:ch_bt-1 data_reg(ch_bt-(m-1),:) = data_reg(ch_bt-(m),:); spread_reg(ch_bt-(m-1),:) = spread_reg(ch_bt-(m),:); b(ch_bt-(m-1)) = b(ch_bt-m);

end end end %----------------- Bits transmitted loop ---------------------

BER(arraycounter)=(Errors/Bits2Tx); %updates BER for that SNR fprintf(')\n');%prints new line in Matlab window

end %-------------------- SNR increment loop--------------------------

if (z == 1)

semilogy(Eb No,BER,'y'); %sets legend for simulation BER end if (z == 2) _

Document info
Document views166
Page views166
Page last viewedTue Dec 06 22:08:30 UTC 2016
Pages69
Paragraphs1770
Words13793

Comments