correlation.m

来自「这个是beyong 3G的一个系统仿真程序,它是MC和CDMA的一个结合系统,采」· M 代码 · 共 15 行

M
15
字号
function corr = correlation(a,b)
% CORRELATION Calculate the correlation of binary sequences
%
%  Corr = CORRELATION(A,B) computes the correlation of binary sequences
%  A and B. The results is stored in a row vector Corr. Each element in 
%  Corr is the correlation of A and a right-shift version of B
%  
%  If A = B, Cor is the autocorrelation of A.
%


for i = 0:length(a)-1
    corr(i+1) = sum(a.*circshift(b,[0 i]));
end

⌨️ 快捷键说明

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