Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12377 > unrolled thread

correlation function

Started byjure lapajne <lapajne.jure@gmail.com>
First post2012-11-18 09:06 +0000
Last post2012-11-19 22:04 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  correlation function jure lapajne <lapajne.jure@gmail.com> - 2012-11-18 09:06 +0000
    Re: correlation function jure lapajne <lapajne.jure@gmail.com> - 2012-11-18 22:21 +0000
      Re: correlation function "Nasser M. Abbasi" <nma@12000.org> - 2012-11-19 22:04 +0000

#12377 — correlation function

Fromjure lapajne <lapajne.jure@gmail.com>
Date2012-11-18 09:06 +0000
Subjectcorrelation function
Message-ID<k8a8el$8bj$1@smc.vnet.net>
Hello,
I'm having hard time calculating correlation (autocorrelation) function of 
two lists (list). I'm trying two different ways of calculating it. One way 
is to use fourier transform and second way is to use Mathematica's function
 ListCorrelate. I get different results but have no idea why. Here's my code:

korelacija1 = ListCorrelate[data, data, {1, 1}];
korelacija11 = Abs[InverseFourier[Abs[Fourier[data]]^2]];

All elements of "data" are real. I have two Abs in second line because for some reason InverseFourier returns small imaginary parts - I know it shouldn't. It's probably only numerical error.

Thanks for help.

[toc] | [next] | [standalone]


#12383

Fromjure lapajne <lapajne.jure@gmail.com>
Date2012-11-18 22:21 +0000
Message-ID<k8bn0f$dj1$1@smc.vnet.net>
In reply to#12377
Why can I see the answer on my email, but not here?
Anyway, I tried your code. I only changed data and the code does not return vector of zeros. Here are my data:
https://docs.google.com/file/d/0B6pDMaS9TDltcnp2UThFYjlPTFk/edit

[toc] | [prev] | [next] | [standalone]


#12386

From"Nasser M. Abbasi" <nma@12000.org>
Date2012-11-19 22:04 +0000
Message-ID<k8eadu$lff$1@smc.vnet.net>
In reply to#12383
On 11/18/2012 4:21 PM, jure lapajne wrote:
> Why can I see the answer on my email, but not here?
> Anyway, I tried your code. I only changed data and the code does not return vector
>  of zeros. Here are my data:
> https://docs.google.com/file/d/0B6pDMaS9TDltcnp2UThFYjlPTFk/edit
>

Becuase many times I send a post to this newsgroup and it never shows up.
This is not the first time.

[Sometimes, news servers fail to send out a message. When you see this
happen send me an email about it - moderator] 

Here it is again. I am using version 8.0.4

Date: Sun, 18 Nov 2012 04:31:35 -0600
From: "Nasser M. Abbasi" <nma@12000.org>
Newsgroups: comp.soft-sys.math.mathematica
CC: jure lapajne <lapajne.jure@gmail.com>

-----------------------------
data  = Table[RandomReal[], {10}];
parms = FourierParameters -> {1, -1};
fft   = Fourier[data, parms];
res1  = Chop[fft*Conjugate[fft]];
res2  = Chop[Fourier[ListCorrelate[data, data, {1, 1}], parms]];
Chop[res1 - res2]
------------------------

Out[38]= {0,0,0,0,0,0,0,0,0,0}

--Nasser

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web