01-02-2014 09:32 PM
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!
01-06-2014 09:37 AM
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.
01-07-2014 04:35 PM
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