Autocorrelation function with ranges

kerdemdemir via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 27 04:04:34 PDT 2015


On Saturday, 27 June 2015 at 10:37:08 UTC, Rikki Cattermole wrote:
> No idea about the maths behind it are but:

Thanks a lot for your answer anyway. I am hoping even not related 
with D directly, this discussions may atract people from other 
languages to D while looking for Domain information.

>
> chain(autoCorrResult[1..$/2])
>
> Should that one be a zero?

I found this link below.
"http://www.aip.de/groups/soe/local/numres/bookcpdf/c13-2.pdf"
Which says :
The correlation at zero lag is in r0, the first component; the 
correlation at lag 1 is in r1, the second component; the 
correlation at lag −1 is in rN−1, the last component; etc.

Correlation result after IFFT is like :

0 1 2 3 ..... T -1 -2 -3 .... -T

How I wanted to be :

-T -T+1 .....    -1 0 1 .... T-1 T

After reading the link I think you are right,

auto finalResult =  chain(autoCorrResult[$/2..$]).
		    chain(autoCorrResult[0..$/2]).
		     map!(a => a.re);

Example above should be the way how I transform. Also now I see
     inverseFft().
     dropBack(residual); ==> DropBack may not be a good idea here. 
I will think about it


More information about the Digitalmars-d-learn mailing list