spreadfunc.m

来自「CDMA中的扩频编码」· M 代码 · 共 22 行

M
22
字号
% Using Matrix to simulate the spread spectrun
% Spreading subfunction
% Write by yixiongshu 2006.7.27
function SpreadData=SpreadFunc(subs_Data,PnSeq)   % the number of row is the number of subscribers.
                                                                                % subs_Data is the multiple subscribers'Data Matrix
                                                                                % PnSeq is the orthognal PN sequence Matrix
Number_of_subs=size(subs_Data,1);                          % the number of subscribers
Length_of_Info=size(subs_Data,2);                             % the bits to be transmitted per subcribers
Sfactor=size(PnSeq,2);                                             % Spreading Factor
Orgin_Data=zeros(Number_of_subs,Length_of_Info*Sfactor);

% Completing the direct spread spectrum.
for i=1:Number_of_subs
    Orgin_Data(i,:)=kron(subs_Data(i,:),PnSeq(i,:));      % Using Kroneck direct multiply to spread the Data
end

% Sum all subcribers'bi-bits to one serial.
para_to_serial=zeros(1,Length_of_Info*Sfactor);
for i=1:Number_of_subs
    para_to_serial=para_to_serial+Orgin_Data(i,:);       % all subscribers information included
end
SpreadData=para_to_serial;                                     % the max value is Number_of_subs

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?