function [out] = ms1(stg, taps, inidata, n)
out = zeros(1, 2^stg-1); %输出数组初始化
fpos = zeros(stg, 1); %寄存器状态初始化
fpos(taps) = 1; %寄存器状态载入 taps = [1,6]; fpos(taps) = [1,0,0,0,0,1]
for l = 1:2^stg-1
out(1,l) = inidata(stg); % 输出第一个点(十进制)
num = mod(inidata*fpos,2); % 乘法按照模2运算
inidata(2:stg) = inidata(1:stg-1); % 移位运算
inidata(1) = num; % 输出反馈给第一个寄存器
end
function [goldseq]=gold_seq(fbconnection1,fbconnection2)
mseq1=m_sequence(fbconnection1);
mseq2=m_sequence(fbconnection2);
N=2^length(fbconnection1)-1;
for shift_amount=0:N-1
shift_mseq2=[mseq2(shift_amount+1:N) mseq2(1:shift_amount)];
goldseq(shift_amount+1,:)=mod(mseq1+shift_mseq2,2);
end
更加详细的你可以看看参考资料的!
http://0605014129.blog.163.com/blog/static/21700061201011891227110/