[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autocorrelation
From: |
Ted Harding |
Subject: |
Re: autocorrelation |
Date: |
Thu, 27 Apr 1995 16:30:48 +0200 (BST) |
( Re Message From: Francesco Potorti` )
>
> I need to compute the autocorrelation of vectors. I started with the
> following experiment:
>
> kk=[2,3,4,5]
> kk =
>
> 2 3 4 5
>
> fftconv(kk,kk)
> ans =
>
> 4 12 25 44 46 40 25
>
> I would have expected
>
> 10 23 38 54 38 23 10
>
> instead. What am I doing wrong?
There's nothing wrong with the answer from fftconv. This computes
a CONVOLUTION, which is defined as
Sum[over s] x(s) * x(t-s)
i.e. one of the factors is taken in the reverse order.
The CORRELATION [at lag t = -(N-1), .. 2, 1, 0, 1, 2, .. , (N-1)]
which you want is defined by
Sum[over s] x(s) * x(s-t) = R(t) = R(-t)
You can get it the right way roud by reversing one of the arguments
to fftconv, if you wish. This gives the result you expected.
Ted. (address@hidden)
- autocorrelation, Francesco Potorti`, 1995/04/27
- Re: autocorrelation,
Ted Harding <=