gold.m
来自「mimo2x2天线选择系统的全系统matlab程序,先前的是dsp程序.」· M 代码 · 共 33 行
M
33 行
% This code is written for educational purpose.
% This Gold code generator is using (5,3) and (5,4,3,2) ML generators.
% If you have any question, contact Prof. Hyoung Joong Kim
% through khj@kangwon.ac.kr
% Ra is the (5,3) ML generator.
% Rb is the (5,4,3,2) ML generator.
% Output Rc has the Gold sequence generated.
% The length of the Gold sequence is 2^5-1.
% The values of Rc depends on the initial values of Ra and Rb.
% In this example, initial values of Ra and Rb are all ones.
clear;
Ra=ones(1,5);
Rb=ones(1,5);
for i=1:31
Rc(i)=mod(Ra(5)+Rb(5),2);
Ra=[mod(Ra(3)+Ra(5),2) Ra(1:4)];
Rb=[mod(Rb(2)+Rb(3)+Rb(4)+Rb(5),2) Rb(1:4)];
end
Ra=[1 0 1 1 1];
Rb=ones(1,5);
for i=1:31
Rd(i)=mod(Ra(5)+Rb(5),2);
Ra=[mod(Ra(3)+Ra(5),2) Ra(1:4)];
Rb=[mod(Rb(2)+Rb(3)+Rb(4)+Rb(5),2) Rb(1:4)];
end
plot(xcorr((2*Rc-1),(2*Rd-1)))
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?