Autocorrelations and Correlogram

58 views (last 30 days)
Hi MATLAB Central,
I am having trouble finding a function which computes and displays a correlogram for the autocorrelation of my spike-train data. From the functions I have found and applied, I feel like my understanding of the Autocorrelation may have some holes in it.
Suppose I have a vector, v, which displays the tonic firing of a neurone. An example of such a trace can be seen here (top trace):
Now I would expect the autocorrelation and correlogram for my vector to give obvious peaks of correlation; a peak at 0 lag, and peaks at every integer multiple of the (constant) inter-spike-interval.
The trouble is, the MATLAB functions do not give this relationship; they give a pyramid shape function. Moreover, the y-axis doesn't occur on a scale between -1 and 1, which I would expect if it was displaying the correlation. Rather it has a max value of 15e08!!
Which autocorrelation function would give me the expected relationship/how am I miss-using these autocorrelation functions?
Thanks,
Linford

Accepted Answer

Wayne King
Wayne King on 16 Mar 2012
Hi Linford, If you use xcorr() with the 'coeff' option you get the normalized autocorrelation sequence which does not exceed 1 in absolute value.
The triangle shape that you speak about is expected. The sample autocorrelation sequence by necessity uses fewer and fewer samples at larger lags (the summation cannot exceed the length of the input vector), so you do expect the sample ACF to decay.
Here is an example with a sinusoid. I'll use a 100 Hz sine wave sample at 1 kHz.
t = 0:0.001:1-0.001;
x = cos(2*pi*100*t);
[xc,lags] = xcorr(x,'coeff');
stem(lags,xc)
Now let's zoom in a bit.
stem(lags(length(x):length(x)+50),xc(length(x):length(x)+50));
xlabel('Lags'); ylabel('ACF');
Now you see that the ACF is oscillating with a period of 10 lags, which is exactly what you expect since the sampling interval is 1 msec and the period is 10 msec.
  3 Comments
Linford Briant
Linford Briant on 16 Mar 2012
So Wayne, obviously this sampling rate is a problem, because the time step in my data is 0.025millisecs. How can I account for this? Should I convert the data into a series of delta-functions when a spike occuts, and in this data use a larer time-step?
Thanks,
L
Wayne King
Wayne King on 16 Mar 2012
Hi Linford, I'm not sure I understand why a 0.025 time interval is a problem. That just means that your lags are in intervals of 0.025 seconds.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!