ccorr_test.m
来自「各种调制仿真程序M语言源代码」· M 代码 · 共 21 行
M
21 行
fbconnection=[0 1 0 0 1];
mseq=m_sequence(fbconnection);
fbconnection1 =[0 0 1 0 1];
fbconnection2 =[0 1 1 1 1];
goldseq=gold_seq(fbconnection1,fbconnection2);
ind1 = find(mseq==0);
mseq(ind1)=-1;
ind2 = find(goldseq==0);
goldseq(ind2)=-1; %把“0”映射成“ - 1”
r1=ccorr(mseq);
r2=ccorr(goldseq(1,:));
r3=ccorr(goldseq(1,:),goldseq(2,:));
N=length(mseq);
axis=-N+1:N-1; %定义横轴使自相关峰值移位到0 点
plot(axis,r1,axis,r2,'- .',axis,r3,':');
xlabel('k');
ylabel('R(k)');
title('伪随机序列的相关特性');
legend('m 序列自相关特性','Gold 序列自相关特性','Gold 序列互相关特性');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?