autocorrelation help [message #82901] |
Fri, 25 January 2013 13:52 |
Oana Coman
Messages: 27 Registered: December 2011
|
Junior Member |
|
|
Hey guys,
I'm trying to run an autocorrelation on a 2D plot and it is giving me way crazy/bad results. Seems simple enough, but it doesn't seem to be giving me what I should be expecting. I ran the following simple example below:
a=indgen(100)*.2-2
b=sin(a)
lag=[-7,-6,-5,-4,-3,-2,-1, 1.0,2,3,4,5,6,7]
autocorr=a_correlate([a,b], lag)
Here are the values in column form for easy viewing:
ENVI> print, transpose(lag)
-7.00000
-6.00000
-5.00000
-4.00000
-3.00000
-2.00000
-1.00000
1.00000
2.00000
3.00000
4.00000
5.00000
6.00000
7.00000
ENVI> print, transpose(autocorr)
0.777030
0.808242
0.839966
0.872025
0.904238
0.936422
0.968397
0.968397
0.936422
0.904238
0.872025
0.839966
0.808242
0.777030
I may be mistaken, but in this instance I have three "sin" type curves which repeat roughly every 6 units. So for lag 6ish, the autocorrelation value should be going back up close to 1-ish. Yet this doesn't seem to be the case in my code.
Can someone help explain to me why this is not working? And hopefully suggest some way to make it work?
Thanks guys!
|
|
|