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

📄 balanced_gold_generator.m

📁 扩频通信常用的 平衡gold序列生成matlab m文件 希望可以上传
💻 M
字号:
function [balanced_gold_seq]=balanced_gold_generator(connections1,connections2)
% BALANCED_GOLD_GENERATOR generate the GOLD sequence
% the shift register connections1 and connections are given as input to the function.
% first determine the two m sequences according to the connections1 and connections2 given
% for 9'th order gold sequences,connections1,connections2 are:
% connections1=[1 0 0 0 1 0 0 0 0]; connections2=[1 1 0 1 1 0 1 1 0];
% for 5'th order gold sequences,connections1,connections2 are:
% connections1=[1 0 1 0 0]; connections2=[1 1 1 0 1];
% for 6'th order gold sequences,connections1,connections2 are:
% connections1=[1 1 0 0 0 0](103F);connections2=[1 1 1 0 0 1](147H);                           
m_seq1=m_generator(connections1); % generate the two m sequences
m_seq2=m_generator(connections2);
% cyclically shift the second sequence and add it to the first one
L=2^length(connections1)-1;
for shift_amount=0:L-1;
    temp=[m_seq2(shift_amount+1:L) m_seq2(1:shift_amount)];
    gold_seq(shift_amount+1,:)=mod((m_seq1+temp),2);
end;
% convert the Unipolar code to Bipolar code
for i=1:L                             
      temp(i,:)=2.*gold_seq(i,:)-1;          
end
% to pick out the balanced gold sequence
t=zeros(1,L);
for i=1:L
    for j=1:L
        t(i)=t(i)+temp(i,j);
    end
end
j=0;
for i=1:L
    if abs(t(i)==1)
       j=j+1;
       balanced_gold_seq(j,:)=temp(i,:);   
   end
end


       

⌨️ 快捷键说明

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