Timelag Crosscorrelation

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

[Data1,SuTraceHeaders,SuHeader]=ReadSu('ux_0gas1Hz_suppress.

su');
s1=Data1(374:528,10);
[Data2,SuTraceHeaders,SuHeader]=ReadSu('ux_100gas1Hz_suppress.su');
s2 = Data2(374:528,10);
% Cross-correlate the two signals
%x = xcorr(s1,s2,0,'coeff');
%xcorr(s1,s2,'coeff');
[corr,lag] = xcorr(s1,s2);% do cross-correlation
[~,I] = max(abs(corr));
lagDiff = lag(I); % express the delay as a number of samples
timeDiff = lagDiff*0.09765625;% 0.09765625 is the sampling rate.

You might also like