complementarycode.m

来自「实现了P4多相码的产生和脉压」· M 代码 · 共 24 行

M
24
字号
function complementaryCode
% 互补码的测试
% according to book <radar handbook>(skolnik),second edition.  pp.399
% notes: must replace 0 with -1 in the serials!
% fuxiongjun  @2006-4-20
% serials1=[1 1 1 0 0 1 1 1 0 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 0 0 ];
clear;
serials1=[1 1 1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 -1];
figure(1);
subplot(311);
plot(xcorr(serials1));
title('auto-correlation of serials 1');
% serials2=[0 0 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 1 1 0 0 1 0 0 0 0 ];
serials2=[-1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 -1];
subplot(312);
plot(xcorr(serials2));
title('auto-correlation of serials 2');
serials_xcorr_all=xcorr(serials1)+xcorr(serials2);
subplot(313);
plot(serials_xcorr_all);
title('sum of auto-correlations of serials 1 & serials 2');
figure(2);
plot(xcorr(serials1,serials2));  % 两序列具有一定的相关性
title('cross-correlation  of serials 1 & serials 2');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?