?? genpncode.m
字號:
function Y=genpncode(sm)
% 產生長度等于 pow2(sm)-1 m序列
% 2002.1.10
l=pow2(sm)-1;
n=[1 0 1 0 1 0 1 0 1 0 1 0];
if sm<3
errordlg('錯誤:sm不應小于3');
break;
end
if sm>10
errordlg('錯誤:sm不應大于10');
break
end
for i=1:l
temp=0;
% 選擇多項式
if sm==3
temp=n(1)+n(3);
end
if sm==4
temp=n(1)+n(4);
end
if sm==5
temp=n(2)+n(5);
end
if sm==6
temp=n(1)+n(6);
end
if sm==7
temp=n(3)+n(7);
end
if sm==8
temp=n(2)+n(3)+n(4)+n(8);
end
if sm==9
temp=n(9)+n(4);
end
if sm==10
temp=n(10)+n(3);
end
% mod(2)
temp=mod(temp,2);
y(i)=n(sm);
if y(i)==0
y(i)=-1;
end
for j=sm:-1:2
n(j)=n(j-1);
end
n(1)=temp;
end
Y=y;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -