?? mseq.m
字號:
function seq = mseq(N)
% usage: seq = mseq(N)
% where: seq = m-sequence of length 2^N -1
% N = order of the m-sequence (max of 14)
% Generates a (+1,-1) maximal-length PN sequence of order N.
% To include the all 1's state, add an extra 1 at the beginning
% for a sequence of length 2^N. (ie. seq=[1,mseq(N)] )
m = 2^N -1; % length
seq = [ones(1,N-1), -1];
if (N==2 | N==3 | N==4 | N==6 | N==7)
for n=N+1:m seq(n)=seq(n-N)*seq(n-1); end; end;
if (N==5 | N==10)
for n=N+1:m seq(n)=seq(n-N)*seq(n-3); end; end;
if (N==8)
for n=N+1:m seq(n)=seq(n-N)*seq(n-4)*seq(n-3)*seq(n-2); end; end;
if (N==9)
for n=N+1:m seq(n)=seq(n-N)*seq(n-5); end; end;
if (N==11)
for n=N+1:m seq(n)=seq(n-N)*seq(n-2); end; end;
if (N==12)
for n=N+1:m seq(n)=seq(n-N)*seq(n-7)*seq(n-4)*seq(n-3); end; end;
if (N==13)
for n=N+1:m seq(n)=seq(n-N)*seq(n-4)*seq(n-3)*seq(n-1); end; end;
if (N==14)
for n=N+1:m seq(n)=seq(n-N)*seq(n-12)*seq(n-11)*seq(n-1); end; end;
if (N==15)
for n=N+1:m seq(n)=seq(n-N)*seq(n-10)*seq(n-8)*seq(n-7)*seq(n-6)*seq(n-2); end; end;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -