# How to measure the “average” autocorrelation of a time-series signal with itself

I have a short time series signal (say around 30 samples), and I would like to check whether or not it's oscillating. One approach I came up with was to measure the autocorrelation of the signal with itself.

Given a random input signal, I would expect an output of 0. Given an oscillating signal I would expect some value consistently greater than 0.

I have run the autocorrelation across all possible offsets of the signal (by "wrapping around" the index and assuming it's periodic), but when I take the mean of the autocorrelations across all possible offsets, I get (almost exactly) 0 no matter what the input signal looks like. This is likely "correct" (although not what I expected), but I can't seem to wrap my head around why that would be.

Is there a better or more correct way of examining the autocorrelations to measure whether or not a signal tends to "agree with a shifted version of itself"? What am I missing?

-
Is your discrete signal periodic, or is it an aperiodic a sampling of a periodic signal? – Mehrdad Mar 5 '13 at 20:49
@Mehrdad Neither? Imagine it's the position of some object along an axis sampled with a consistent period. If that object is just randomly moving around, I would expect this "average autocorrelation" to be effectively 0, but if the object begins oscillating I would expect the delayed copies to create peaks in the autocorrelation values and make the "average autocorrelation" non-zero. – aardvarkk Mar 5 '13 at 20:58
@Mehrdad So to answer the first half of your question, it's a discrete but not necessarily periodic signal. And to answer the second half, it's a periodic sampling of a possibly-but-not-necessarily periodic signal. My goal is to determine when the signal is acting periodic by trying to identify the times when the autocorrelation tends to be high at multiple offsets, if that makes sense. – aardvarkk Mar 5 '13 at 21:05
Okay, I see. Well, if your discrete signal is itself not exactly periodic, then it won't match up with itself when you shift it, as it'll be matching up with a sample from a slightly different offset in the next period -- so why do you expect the autocorrelation to be positive? (I suspect it might be positive if all you have is a handful of periods, but if you have enough periods I would think it might be zero.) – Mehrdad Mar 5 '13 at 21:31
@Mehrdad Well my hope was that if a signal was at all periodic, I'd like to capture that somehow. Such a signal should have higher peaks in the set of all possible autocorrelation shifts. So I was thinking if I took the average of them, it would bump up just a bit higher if the input signal was "more periodic" (as opposed to entirely random). I don't expect all of the correlations to be high, but if there are multiple periodic-ish peaks, they should line up at certain offsets. Maybe I'll stick with my absolute-value of autocorrelation version! – aardvarkk Mar 5 '13 at 21:41