LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

My autocorrelation attempt - help nedded

So I need some help in coding my own autocorrelation algorithm.  The problem I have with the one that comes with LV is that it does not result in a the curve that is expected from my data; ie the resulting autocorrelation is not 'smoothly' exponetional.  So to remedy this I have tried to write my own autocorrelation code for the equation I am using.  However I am having a bit of trouble in getting this to work.  In my last iteration, the code 'worked' - if you call getting zero working! (which I don't).

So any help or advice would be muchly appreciated.  I have included the code I have put together, one of the sets of raw data and the equation and related details (as a pdf) all together in a zip file.

So with regards to the data file.  It has a bunch of header information (which I remove in the algorithm) and two columns of data.  One column is time and the other column is for Intensity.  It is the intensity data that I am interested in doing the autocorrelation on.
0 Kudos
Message 1 of 5
(3,392 Views)

Hi scottum,

 

I'm a little confused by the PDF document you attached.  Are you supposed to iterate from j=0 to j=end of the array and calculate Rj for each value?  I'm running a test right now, with 100,000 it's taking a while.

 

Thank goodness for Parallel Loops! 

0 Kudos
Message 2 of 5
(3,372 Views)

Hi scottum,

 

This is what I got with the algorithm I attached below:

 

Autocorrelation.png 

Does this look right to you?

 

 

Download All
0 Kudos
Message 3 of 5
(3,369 Views)
Hi Kyle,

My understanding is that I do need to iterate from j=0 to j=end of the array.  Although in my attempt I was going from j=0 to j=n-1 purely because when you are dividing the sum by 1/n-j then you really don't want j to equal n.

From the image you posted that is not what I was expecting unfortunately.  I am expecting that the data will decay exponentially as the delay time increases.  I wasn't able to look at your code today because I currently have LV 8.6.1 installed (was planning to install the newest version but wasn't able to today).  I will try to get it working next week.

Thanks,

Scott
0 Kudos
Message 4 of 5
(3,352 Views)

Don't give up on the canned stuff so quickly. Try this. Find the average value of your y-data and divide by it so that you now have y-data with a (scaled) average value of 1. when you use the autocorrelation subVI, set the normalization method to unbiased:

 

code snippet.JPG

0 Kudos
Message 5 of 5
(3,339 Views)