Main Content

지수 시퀀스의 자기상관 함수

28개의 샘플로 구성된 지수 시퀀스 x=0.95n(n0)의 자기상관 함수를 계산합니다.

a = 0.95;

N = 28;
n = 0:N-1;
lags = -(N-1):(N-1);

x = a.^n;
c = xcorr(x);

결과의 정확성을 확인하기 위해 해석적으로 c를 구합니다. 더 큰 샘플 레이트를 사용하여 연속적인 상황을 시뮬레이션합니다. 시퀀스 x(n)=an(|a|<1)의 자기상관 함수는 n0인 경우 다음과 같습니다.

c(n)=1-a2(N-|n|)1-a2×a|n|.

fs = 10;
nn = -(N-1):1/fs:(N-1);

dd = (1-a.^(2*(N-abs(nn))))/(1-a^2).*a.^abs(nn);

동일한 Figure에 시퀀스를 플로팅합니다.

stem(lags,c);
hold on
plot(nn,dd)
xlabel('Lag')
legend('xcorr','Analytic')
hold off

Figure contains an axes object. The axes object with xlabel Lag contains 2 objects of type stem, line. These objects represent xcorr, Analytic.

계산을 반복하되 이번에는 무편향 자기상관 추정값을 구합니다. cu(n)=c(n)/(N-|n|) 식으로 편향되지 않은 추정값이 산출되는지 확인합니다.

cu = xcorr(x,'unbiased');

du = dd./(N-abs(nn));

stem(lags,cu);
hold on
plot(nn,du)
xlabel('Lag')
legend('xcorr','Analytic')
hold off

Figure contains an axes object. The axes object with xlabel Lag contains 2 objects of type stem, line. These objects represent xcorr, Analytic.

계산을 반복하되 이번에는 편향 자기상관 추정값을 찾습니다. cb(n)=c(n)/N 식으로 편향 추정값이 산출되는지 확인합니다.

cb = xcorr(x,'biased');

db = dd/N;

stem(lags,cb);
hold on
plot(nn,db)
xlabel('Lag')
legend('xcorr','Analytic')
hold off

Figure contains an axes object. The axes object with xlabel Lag contains 2 objects of type stem, line. These objects represent xcorr, Analytic.

지연 0에서의 값이 단위 값이 되는 자기상관 추정값을 찾습니다.

cz = xcorr(x,'coeff');

dz = dd/max(dd);

stem(lags,cz);
hold on
plot(nn,dz)
xlabel('Lag')
legend('xcorr','Analytic')
hold off

Figure contains an axes object. The axes object with xlabel Lag contains 2 objects of type stem, line. These objects represent xcorr, Analytic.

참고 항목

함수