?? despreadfunc.m
字號:
% Despread Function
% Write by yixiongshu 2006.7.27
function DespreadData=DespreadFunc(SpreadData,PnSeq)
Length_of_PnSeq=size(PnSeq,2);
Number_of_PnSeq=size(PnSeq,1);
Length_of_SpreadData=length(SpreadData);
Length_of_Info=Length_of_SpreadData/Length_of_PnSeq;
Despread_Pn_seq=zeros(Number_of_PnSeq,Length_of_SpreadData); % Initialize a matrix to desposit the PN
Despread_Data1=Despread_Pn_seq; % Initialize a swap matrix
for i=1:Number_of_PnSeq
Despread_Pn_seq(i,:)=kron(ones(1,Length_of_Info),PnSeq(i,:)); % Spread the
% PN Matrix to match the SpreadData
Despread_Data1(i,:)=Despread_Pn_seq(i,:).*SpreadData; % the first step to despread the data
end
Despread_Data2=zeros(Number_of_PnSeq,Length_of_Info); % the matrix to store
% the origin despread data
% the second step to despread the Data
% the Result is the expected Information,we can compare the result with the
% origin infomation data,and get the BER
for i=1:Number_of_PnSeq
for j=1:Length_of_Info
Despread_Data2(i,j)=sum(Despread_Data1(i,1+(j-1)*Length_of_PnSeq:j*Length_of_PnSeq));
if Despread_Data2(i,j)>0
Despread_Data2(i,j)=1;
else
Despread_Data2(i,j)=-1;
end
end
end
DespreadData=Despread_Data2;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -