Main Content

상호상관을 사용하여 신호 정렬하기

많은 경우 측정값에는 다수의 센서를 통해 비동기식으로 수집된 데이터가 포함됩니다. 신호를 통합하여 함께 분석하려면 신호를 동기화해야 합니다. 이런 경우에는 xcorr을 사용하십시오.

예를 들어, 다리를 건너는 자동차를 고려해 보겠습니다. 자동차에서 발생하는 진동은 서로 다른 곳에 있는 3개의 동일한 센서에서 측정됩니다. 신호의 도착 시간은 각기 다릅니다.

신호를 MATLAB® 작업 공간에 불러온 다음 플로팅합니다.

load relatedsig

tiledlayout(3,1)

ax(1) = nexttile;
plot(s1)
ylabel("s_1")

ax(2) = nexttile;
plot(s2)
ylabel("s_2")

ax(3) = nexttile;
plot(s3)
ylabel("s_3")
xlabel("Samples")

linkaxes(ax,"x")

Figure contains 3 axes objects. Axes object 1 with ylabel s_1 contains an object of type line. Axes object 2 with ylabel s_2 contains an object of type line. Axes object 3 with xlabel Samples, ylabel s_3 contains an object of type line.

세 쌍의 신호 간의 상호상관을 계산합니다. 최댓값이 1이 되도록 상호상관을 정규화합니다.

[C21,lag21] = xcorr(s2,s1);
C21 = C21/max(C21);

[C31,lag31] = xcorr(s3,s1);
C31 = C31/max(C31);

[C32,lag32] = xcorr(s3,s2);
C32 = C32/max(C32);

상호상관의 최댓값 위치는 시간 선행 또는 지연을 나타냅니다.

[M21,I21] = max(C21);
t21 = lag21(I21);

[M31,I31] = max(C31);
t31 = lag31(I31);

[M32,I32] = max(C32);
t32 = lag32(I32);

상호상관을 플로팅합니다. 각 플롯에 최댓값의 위치를 표시합니다.

tiledlayout(3,1)

nexttile
plot(lag21,C21)
xline(t21,"-","Lag: "+t21,LabelOrientation="horizontal")
ylabel("C_{21}")
title('Cross-Correlations')

nexttile
plot(lag31,C31)
xline(t31,"-","Lag: "+t31,LabelOrientation="horizontal")
ylabel("C_{31}")

nexttile
plot(lag32,C32)
xline(t32,"-","Lag: "+t32,LabelOrientation="horizontal")
ylabel("C_{32}")
xlabel("Samples")

Figure contains 3 axes objects. Axes object 1 with title Cross-Correlations, ylabel C_{21} contains 2 objects of type line, constantline. Axes object 2 with ylabel C_{31} contains 2 objects of type line, constantline. Axes object 3 with xlabel Samples, ylabel C_{32} contains 2 objects of type line, constantline.

s2s1보다 350개 샘플만큼 앞서 있고, s3s1보다 150개 샘플만큼 뒤처져 있습니다. 따라서 s2s3보다 500개 샘플만큼 앞서 있습니다. 더 긴 지연을 갖는 벡터에서 지연을 제거하여 신호를 정렬합니다. 이제 신호가 동기화되었으며 추가적인 처리가 가능합니다.

s1 = s1(-t21:end);
s3 = s3(t32:end);

tiledlayout(3,1)
ax(1) = nexttile;
plot(s1)
ylabel("s_1")

ax(2) = nexttile;
plot(s2)
ylabel("s_2")

ax(3) = nexttile;
plot(s3)
ylabel("s_3")
xlabel("Samples")

linkaxes(ax,"x")

Figure contains 3 axes objects. Axes object 1 with ylabel s_1 contains an object of type line. Axes object 2 with ylabel s_2 contains an object of type line. Axes object 3 with xlabel Samples, ylabel s_3 contains an object of type line.

참고 항목

| |

관련 항목