# Autocorrelation on a 1D wave

Hi,

I am running autocorrelation on a 1D wave and need to get out a graph with the Pearson correlation coefficient on the y-axis and the lag number on the x-axis. I tried the autocorrelation function from the allstatsprocedures library and also correlate/Auto but neither of the two are giving me what I need. I also do not see any outputs in the command window from which I could extract this info after running the library function.

Kindly advise how can I do this.

Thanks a ton!

Peeyush

I think it is important to clearly define what you need:

If you have a single wave and you want to compute the "Pearson correlation coefficient" you will get exactly one number (see the equation for r in the documentation for the StatsCorrelation operation).  For one wave only the result is uninteresting as you can see from the equation.

If you want to compute the "autocorrelation" you should look at the Correlate operation with /AUTO flag.

A.G.

Hi A.G.

Thanks for your response and advice. Actually, I need to run autocorrelation on a 1D wave, and create a graph where the y-axis is the correlation coefficient, r, and x-axis is the lag. The intention is to find the index number where the correlation coefficient value transitions from positive to negative, and I basically need to find the last positive correlation coefficient in the autocorrelation process of the 1D wave.

Does this help in clarifying things a little bit?

Sincerely,

Peeyush

Try the following:

Make/O/N=1000 ddd=sin(pi*x/30)+enoise(0.7)
display ddd
Duplicate/O ddd,W_Correlation
Correlate/AUTO ddd, W_Correlation
Display W_Correlation