⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pr6_44.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem 6.44
%exhaustive search of  binary code with optimal aperiodic ACF;

clear all; close all;
t=cputime;
N=input('length N='); %specify length of binary sequence;
Rm=N; %initialization of maximal ACF sidelobe;
M=2^(N-1)-1; %size of set to search on, last symbol of a code is always +1;
for k=1:M
    A=[bitget(k,1:N-1) 0]; A=(-1).^A; %binary code;
    R=filter(A(N:-1:1),1,A); R1=max(abs(R(1:N-1))); %ACF calculation;
    if R1<Rm Rm=R1; Ao=A; end; %replacement of maximal sidelobe and code if a better code found;
end;
Rmn=Rm/N; %norming;
T=cputime-t;
Ra=xcorr(Ao)/N; %ACF of best code;
Rp=[1 Ra(N+1:2*N-1)+Ra(1:N-1) 1]; %its periodic ACF;
plot([0:N],[Ra(N:2*N-1) 0],'b',[0:N],Rp,'r'); ylim([-2*Rmn-0.2 1.2]); ylabel('R(m)'); xlim([0 N]); grid; %plotting aperiodic and periodic ACFs of the found code;
disp('       N        Rm       Rmn         T');
disp([N,Rm,Rmn,T]); %displays length, non-normalized maximal sidelobe, normalized one, execution time; 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -