📄 pr6_48.m
字号:
%Problem 6.48
%Legendre sequence generator;
clear all, close all;
N=251; %setting up length;
tst=isprime(N); if tst==0 error('Change N! It is not prime'); end;
ksi=prel(N); %finding primitive element;
a=[1 -ones(1,N-1)]; %initialization of Legendre sequence;
pl=1; %initialization of positions with plus ones;
for k=0:(N-1)/2-1;
pl=emn(ksi,2*k,N); a(pl+1)=1; %finding +1 positions and putting +1 there;
end; %sequence ready;
R=xcorr(a)/N; R=[R(N:2*N-1)]+[0 R(1:N-1)]; %ACF
t=[0:2*N];
subplot(211);
stairs(t,[a a a(1)]); xlim([0 2*N]); ylim([-1.2 1.2]); ylabel('s(t)'); xlabel('t'); grid; %plotting sequence;
subplot(212);
plot(t,[R R R(1)]); xlim([0 2*N]); ylim([-0.2-1/N 1.2]); ylabel('R(t)'); xlabel('\tau'); grid; %plotting PACF;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -