Aligning 2 signals using cross correlation

조회 수: 13 (최근 30일)
Mp897
Mp897 2013년 10월 7일
댓글: dpb 2013년 10월 8일
I want to align 2 signals of same sampling rate using cross correlation. I was thinking of taking 1min data of signal 2 and finding the cross correlation(highest correlation value) at signal1. How do I find the cross correlation at every point on signal 1? Is there any better method? Signal 1: 4000seconds;Signal 2: 2500seconds. Please pour in your suggestions. Thanks for your time.

답변 (2개)

dpb
dpb 2013년 10월 8일
doc xcorr
Seems like I answered this and gave an example application not that long ago (then again, it could have been on the newsgroup instead, I don't recall). Try a search on my answers and correlation and see if joy ensues...
But, it's pretty much just do the cross correlation, find the largest lag and adjust...

Image Analyst
Image Analyst 2013년 10월 8일
The max of a cross correlation shows where the sum of the products of the signals is max but that is not necessarily where you would visually place the signal if you did it manually. For example a Gaussian and a big giant step (rect function) correlated with another Gaussian (same as the first one) may put the max at the big giant step rather than where the two Gaussians overlap exactly. This is why normalized cross correlation was invented, and that may work better for you. It's done by normxcorr2 in the Image Processing Toolbox. I have a demo for it that I've attached below. A discussion of template matching methods is given here: http://en.wikipedia.org/wiki/Template_matching
  댓글 수: 1
dpb
dpb 2013년 10월 8일
Yeah, if the two signals are disparate simple correlation may lead to peculiar results -- I was presuming OP has similar waveforms that weren't collected respective to a consistent triggering for which correlation generally works well...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by