求用MATLAB Simulink产生m序列和Gold序列的程序,谢谢了,急用

2024-12-16 01:14:52
推荐回答(1个)
回答1:

function [mseq ] = mseries (coefficients);
len = length (coefficients) ;
L = 2^len - 1 ; %所需的移位寄存器的长度
registers = [zeros (1 ,len - 1) ,1 ] ; %初始寄存器内容
mseq (1) = registers (1) ;
for i = 2 :L
newregisters (1 :len - 1) = registers (2 :len) ;
newregisters ( len) = mod ( sum ( coefficients. 3
registers) ,2) ;
registers = newregisters ;
mseq (i) = registers (1) ;
end