📄 pr6_47m.m
字号:
%Problem 6.47 modified;
%finds first binary primitive polynomial;
clear all; close all;
fprintf('\n');
n=14; %set degree of polynomial;
N=2^n-1; %m-sequence length;
din=[1,zeros(1,n-1)]; %initial LFSR loading;
Rm=0; k=1; %initialization of search;
while Rm>-0.9
f=[1 bitget(k,1:n-1) 1]; d=lseq(f,din); a=-2*d+1; %calculates linear sequence and concverts it to binary {+1,-1} alphabet;
R=xcorr(a); %calculates ACF
Rm=max(R(N+1:2*N-1)+R(1:N-1)); %test whether we came to m-sequence or other sequence by checking periodic ACF;
k=k+1;
end;
disp('primitive polynomial');
disp(f);
beep;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -