max_length.m

来自「In 揚erformance of multi-carrier DS CDMA 」· M 代码 · 共 35 行

M
35
字号
function  [seq] = max_length(connection);
% ----------------------------------------------------------------------- %
connection = fliplr(connection);
% number of registers
m = length(connection)-1;  

% length of sequences
L = 2^m-1;

%initial condition
register = [zeros(1,m-1),1]; 
initial = register;
seq(1) = register(1);  
for i=2:L
	for j=1:m-1,
   	new_reg_cont(j) = register(j+1);
   end;
   new_reg_cont(m) = register(1);
   for k=2:m
      new_reg_cont(m) = new_reg_cont(m)+register(k)*connection(k);
      new_reg_cont(m) = mod(new_reg_cont(m),2);
	end;
   register = new_reg_cont;
   seq(i) = register(1); 
   if (initial==register)
      disp('the connection is not valid to generate maximum length sequences');
      break
   end
end

%find other all sequences
for a = 2:L
   seq(a,:) = wshift('1D',seq(a-1,:),1);
end
% ----------------------------------------------------------------------- %

⌨️ 快捷键说明

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