DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a Diadem script or command to determine the maximum lag of cross correlated data?

I am analyzing multiple data sets and ultimately need to plot and align 3 similar curves based on the the maximum cross correlation lag.  Is there a function that will do this in Diadem or has anyone written a script to do so?  I am new to Diadem and am still learning how to do this.  I know I can do it in Matlab...the generic coding is

 

%calculate cross-correlation
c = xcorr(a,b - mean(b),'coeff');
% return maximum value and its index
[d,f] = max(c);
timelag = (length(a) - f) * timestep;

 

I would really like to figure out how to do this in Diadem as it seems like it will be easier based on the amount of data I am going to have to analyze.  Any thoughts would be greatly appreciated.  I have found and was looking at the cross correlation function in the signal analysis toolbar but I do not see where lag is calculated.

 

thanks!

0 Kudos
Message 1 of 3
(6,015 Views)

Hi,

 

It looks like in you example code you are calculating the timelag separately which is how you would also do it in DIAdem. On the help page for Cross Correlation in DIAdem, it shows how the function is used. It appears the fuction is equivalent to the first section of your example then you would have to use the output data in order to calculate timelag in the same manner.

Evan See
National Instruments
0 Kudos
Message 2 of 3
(5,913 Views)

Hi jgabe,

 

Here is an example VBScript that uses cross-correlation to time shift all equivalently named channels across the various groups in the Data Portal.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 3 of 3
(5,868 Views)