📄 goldcodegenerator.m
字号:
function [c1n_out_bipolar,c2n_out_bipolar]= GoldCodeGenerator(L)
n=25;
x=ones(1,n);
x_c2n=0;
y_c1n=0;
Length_max=(2^n)-1;
for i=1:L % it should be equal to Length_max to generate all possible Gold codes
y=dec2bin(i,n);
for j=1:24576 % Length_max
c1n(i,j)=mod(x(25)+y(25),2); % considering x(25) to be the LSB, or the bit associated to degree 0
c2n(i,j)=mod(x_c2n+y_c1n,2); % somehow inverting the ordering of the schema in IAS
x=[mod(x(25)+x(22),2) x(1:n-1)];
x_c2n=mod(x(7)+x(18)+x(21),2);
y=[mod(y(25)+y(24)+y(23)+y(22),2) y(1:n-1)];
y_c1n=mod(y(8)+y(19)+y(21),2);
end
end
% for index=1:32
% AutoCorrC1n=xcorr(c1n(index,:),c1n(index,:));
% AutoCorrC2n=xcorr(c2n(index,:),c2n(index,:));
% end
c1n_out_bipolar(:,:)=2*c1n(:,:)-1;
c2n_out_bipolar(:,:)=2*c2n(:,:)-1;
% AutoCorrC1n_out=AutoCorrC1n;
% AutoCorrC2n_out=AutoCorrC2n;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -