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

📄 longcode.m

📁 Rake receiver of CDMA
💻 M
字号:
function [s]=longcode(n)
%  find the long code Sequence of 2^15 or 2^42
%  s=longcode(n), n: length of code

%
% Copyright: Xiaohua(Edward) Li, Assistant Professor
%            Department of Electrical and Computer Engineering
%            State University of New York at Binghamton
%            http://ucesp.ws.binghamton.edu/~xli
% June 2003
%
%L=15;  % choose L=15 to generate PN code with max length 2^15
L=42;  % choose L=42 to generate PN code with max length 2^42
if L==15,  
   init=ones(1,L);   
   fdbk=[0 0 1 1 1 1 0 0 0 1 1 1 0 0 1];  % feedback shifting register
elseif L==42
   init=[0 ones(1,L-1)];
      fdbk=[1 1 1 0 1 1 1 0 0 1 0 0 0 0 0 ... % feedback shifting register
            1 1 1 1 0 1 1 0 0 1 1 1 0 0 0 ...
            1 0 0 0 1 0 0 0 0 0 0 1];
end
   
s=zeros(1,n+L);
for i=1:n+L                   % generate PN code sequence
  s(i)=init(L);
  f=fdbk*init.';  
  init(2:L)=init(1:L-1);
  init(1)=mod(f,2);
end 
s=s(L+1:n+L);

s=2*s-1;                      % change code to be +/- 1

⌨️ 快捷键说明

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