自相关函数是描述随机信号x(t)在任意两个不同时刻t1,t2的取值之间的相关程度.设原函数是f(t),则自相关函数定义为r(u)=f(t)*f(-t),其中*表示卷积.给个例子:dt=.1;t=[0:dt:100];x=cos(t);[a,b]=xcorr(x,'unbiased');plot(b*dt,a)上面代码是求自相关函数并作图,matlab中查看帮助时,help xcorr 解释其意思是: c(m) = e[a(n+m)*conj(b(n))] = e[a(n)*conj(b(n-m))];但是,在调用xcorr函数求自相关时,有 scaleopt参数r=xcorr(s,scaleopt)scaleopt有 'biased' - scales the raw cross-correlation by 1/m. 'unbiased' - scales the raw correlation by 1/(m-abs(lags)). 'coeff' - normalizes the sequence so that the auto-correlations at zero lag are identically 1.0. 'none' - no scaling (th** ** the default).注意观察下面的测试:s = [1 2 3]r = xcorr(s);r = 3.0000 8.0000 14.0000 8.0000 3.0000当用r=xcorr(s,'unbiased')时就能得到r =3.0000 4.0000 4.6667 4.0000 3.0000 20210311