⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 despreadfunc.m

📁 CDMA中的扩频解扩
💻 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 + -