?? longcode.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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -