📄 pr7_41.m
字号:
%Problem 7.41;
%Generating Kasami ensemble;
clear all; close all;
n=8; %set up long m-sequence memory, n is even;
L=2^n-1; K=2^(n/2); %length of m-sequence and number of Kasami sequences;
d=bmsq(n); %constructing m-sequence;
t=K+1; %decimation index;
c=d(mod(t*[0:L-1],L)+1); c=1-2*c; %short m-sequence obtained by decimation;
Ks=[zeros(K-1,L);1-2*d]; %template of Kasami set;
for k=1:K-1
c=circshift(c,[0,1]);
Ks(k,:)=Ks(K,:).*c; %symbolwise product of shifted c by d;
end; %Kasami set ready;
R=xcorr(Ks'); %aperiodic correlation functions of all sequences;
R=R'; R=R(:,L:end)+[zeros(K^2,1),R(:,1:L-1)]; %all periodic correlations;
Ind1=[1:K+1:K^2]; Ind2=setdiff([1:K^2],Ind1); %separation of ACF and CCF places in R;
Ram=max(max(abs(R(Ind1,2:end)))); Rcm=max(max(abs(R(Ind2,:)))); Rm=max(Ram,Rcm); %maximal ACF sidelobe and CCF peak;
fprintf('\n');
disp(' length K Ram Rcm SqRm SqRm bound');
disp([L,K,Ram,Rcm,(Rm^2)/(L^2),(K-1)/(K*L-1)]); %displays length, number of sequences in set, maximal ACF sidelobe, maximal CCF peak, squared correlation peak and its lower bound;
subplot(311); plot([0:L],[R(K^2,:),R(K^2,1);R(K,:),R(K,1)]'/L); ylabel('Ra(\tau), Rc(\tau)'); xlim([0,L]); grid; ylim([-1.2*Rm/L,1.2]); legend('ACF','CCF'); %plotting ACF of initial and CCF of initial m-sequences and other Kasamim sequence;
subplot(312); plot([0:L],[R(1,:),R(1,1);R(2,:),R(2,1)]'/L); ylabel('Ra(\tau), Rc(\tau)'); xlim([0,L]); grid; ylim([-1.2*Rm/L,1.2]); legend('ACF','CCF'); %plotting ACF and CCF of non-initial sequences;
xlabel('\tau/\Delta');
R1=[reshape(R(Ind1,2:end),1,K*(L-1)),reshape(R(Ind2,:),1,(K^2-K)*L)]; %linear vector to build the histogram;
hs=hist(R1,[-Rm-2:Rm+2])/length(R1); %calculation of CF histogram;
subplot(313); bar([-Rm-2:Rm+2]/L,hs); xlim([-Rm-2,Rm+2]/L); ylim([0,1.2*max(hs)]); xlabel('correlation'); ylabel('occurences'); grid; %plotting histogram of correlations;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -