请解释matlab中程序每一行的意思,谢谢函数m_sequence.m :function[mseq]=m_sequence(fbconnection);n=length(fbconnection);N=2^n-1;register=[zeros(1,n-1) 1]; mseq(1)=register(n); for i=2:Nnewregister(1)=mod(sum(fbconnection.*
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/06 11:27:12
![请解释matlab中程序每一行的意思,谢谢函数m_sequence.m :function[mseq]=m_sequence(fbconnection);n=length(fbconnection);N=2^n-1;register=[zeros(1,n-1) 1]; mseq(1)=register(n); for i=2:Nnewregister(1)=mod(sum(fbconnection.*](/uploads/image/z/2607835-67-5.jpg?t=%E8%AF%B7%E8%A7%A3%E9%87%8Amatlab%E4%B8%AD%E7%A8%8B%E5%BA%8F%E6%AF%8F%E4%B8%80%E8%A1%8C%E7%9A%84%E6%84%8F%E6%80%9D%2C%E8%B0%A2%E8%B0%A2%E5%87%BD%E6%95%B0m_sequence.m++%EF%BC%9Afunction%5Bmseq%5D%3Dm_sequence%28fbconnection%29%3Bn%3Dlength%28fbconnection%29%3BN%3D2%5En-1%3Bregister%3D%5Bzeros%281%2Cn-1%29+1%5D%3B+++++++++++mseq%281%29%3Dregister%28n%29%3B++++for+i%3D2%3ANnewregister%281%29%3Dmod%28sum%28fbconnection.%2A)
请解释matlab中程序每一行的意思,谢谢函数m_sequence.m :function[mseq]=m_sequence(fbconnection);n=length(fbconnection);N=2^n-1;register=[zeros(1,n-1) 1]; mseq(1)=register(n); for i=2:Nnewregister(1)=mod(sum(fbconnection.*
请解释matlab中程序每一行的意思,谢谢
函数m_sequence.m :
function[mseq]=m_sequence(fbconnection);
n=length(fbconnection);
N=2^n-1;
register=[zeros(1,n-1) 1];
mseq(1)=register(n);
for i=2:N
newregister(1)=mod(sum(fbconnection.*register),2);
for j=2:n
newregister(j)=register(j-1);
end;
register=newregister;
mseq(i)=register(n);
end
请解释matlab中程序每一行的意思,谢谢函数m_sequence.m :function[mseq]=m_sequence(fbconnection);n=length(fbconnection);N=2^n-1;register=[zeros(1,n-1) 1]; mseq(1)=register(n); for i=2:Nnewregister(1)=mod(sum(fbconnection.*
function[mseq]=m_sequence(fbconnection);%%函数声明,函数名字m_sequence,函数输入变量fbconnection,函数输出mseq
n=length(fbconnection);%%得到fbconnection的长度
N=2^n-1;%%得到循环次数
register=[zeros(1,n-1) 1];%%建立大小为1*n的矩阵,前n-1个元素都为0,第n个元素为1
mseq(1)=register(n); %%让输出的第一个元素为1
for i=2:N%%i从2开始循环,一直去到N
newregister(1)=mod(sum(fbconnection.*register),2); %%让fbconnection和register中对应元素相乘,并求和,然后除以2得余数赋给newregister的第一个元素
for j=2:n
newregister(j)=register(j-1);%%把register的前n-1个元素赋给newregister的第2-n个元素,也就是全0
end;
register=newregister;%%把newregister的值赋给register
mseq(i)=register(n);%%把register的第n个元素的值赋给mseq的第i个元素
end