📄 pr6_52.m
字号:
%Problem 6.52;
%ternary sequences with perfect PACF;
clear all; close all;
p=31; %set up basic prime field;
f=[1,0,30,22]; %input polynomial as n-vector from table 6.5;
n=length(f)-1; %degree of polynomial, sequence memory;
N=(p^n-1)/(p-1); %length of sequence;
f1=mod(-f(n+1:-1:2),p); %in the recurrence negative coefficients of polynomial should be used;
IL=[1,zeros(1,n-1)]; %initial loading;
Wd=IL; a=IL; %n-window and initial segment of ternary sequence;
for k=1:N-n
dn=mod(Wd*f1',p); %recurrence gives the next element of linear sequence;
if dn~=0 an=emn(dn,(p-1)/2,p); else an=0; end; %binary character is calculated by exponentition of dn to (p-1)/2 modulo p;
if an==p-1 an=-1; end; %transforms minus ones modulo p into real minus ones;
a=[a,an]; %current and all previous elements of ternary sequence;
Wd=[Wd(2:n),dn]; %window for forming next element of linear sequence;
end; %ternary sequence ready;
Ra=xcorr(a); Rp=Ra(N:2*N-1)+[0,Ra(1:N-1)]; R=[Rp,Rp,Rp(1)]/Rp(1);
subplot(211)
stairs([0:2*N],[a,a,a(1)]); ylim([-1.2,1.2]); ylabel('s(t)'); xlabel('t/\Delta'); grid; xlim([0,2*N]); %plots ternary sequence;
subplot(212)
plot([0:2*N],R); ylim([-0.2,1.2]); ylabel('R(\tau)'); xlabel('\tau/\Delta'); grid; xlim([0,2*N]);
disp(' p n N nu');
disp([p,n,N,N/Ra(N)]); %displays field order, memory, length, peak-factor;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -