4
$\begingroup$

I have 1 dimensional data series sampled at even time intervals; they are noisy but have the exactly the same (unknown) underlying curve - with one difference: they are offset in time by some unknown tau. What is the best (most robust) estimate of that tau? Also, what is an estimate that can be calculated quickly (that is not one of the moments of the distribution)?

$\endgroup$
  • 2
    $\begingroup$ can you show a picture? do you know anything about the underlying curve? $\endgroup$ – Karl Sep 27 '11 at 19:10
6
$\begingroup$

The maximum of the cross-correlation function can be used for that.

http://en.wikipedia.org/wiki/Cross-correlation

(at least I know that it was used successfully in EEG time-series analysis, paper by Woody).

This is an example, I hacked together:

enter image description here

The top plot shows two noisy chirp-signals, the red one is offset by some 80 sampling points. The cross-correlation plot shows a clear peak at the correct offset. In MATLAB you can get the tau-estimate with

[xc,lags]=xcorr(y1,y2);
[m,i]=max(xc);
tau=lags(i);

where y1 and y2 are the two input signals.

This is the MATLAB code for generating the figure:


% generate 2 signals
t = 0:0.001:0.5;            
y = chirp(t,0,1,150);
y2= [cos(0:0.1:2*pi) y];
y2= y2(1:size(y,2));

% add noise
yr =y +0.9*rand([1 size(y,2)]);
y2r=y2+0.9*rand([1 size(y,2)]);

% plot signals
subplot( 2,1,1)
plot(yr);
hold on
plot( y2r, 'r');
hold off

% plot cross-correlation
subplot( 2, 1,2)
[z, lags]=xcorr(yr, y2r);
plot( lags, z(1:end));

$\endgroup$
  • $\begingroup$ Could you provide an example? In general your idea seems valid, but answer with more details would be of great help not only for the asker but for other people who will come to this site with similar problems. $\endgroup$ – mpiktas Sep 30 '11 at 13:53
  • $\begingroup$ ok, thanks for the guidance. I did a quick matlab-hack to provide an example and posted it into the solution... $\endgroup$ – thias Sep 30 '11 at 14:31
  • $\begingroup$ Thanks for update, now it is much clearer. I've added the image to your post, but I think soon you will not have the problem with reputation restrictions. It would be great however if you added the code how you generated the xc, so that anybody could reproduce the graph and the methodology :) $\endgroup$ – mpiktas Sep 30 '11 at 14:35
  • $\begingroup$ thanks for the edit. I didn't even know it was possible to edit someone else's answer :-) I also posted the code $\endgroup$ – thias Sep 30 '11 at 14:45
2
$\begingroup$

The problem is known as "time delay estimation". If the delay ("tau") is assumed to be constant, the most usual techniques are based on searching a maximum on the cross correlation function. But there are several refinements, many of which corresponds to some "generalized cross-correlation" (which are conceptually similiar to applying some pre-equalization to the signals), I've had good results with the "SCOT" generalized correlation. There are many papers, search for "generalized correlation" "Time delay" "SCOT" "PHAT" For example: http://dodreports.com/pdf/ada393232.pdf.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.