Correlation of vector data, currently as x and y in two waves
| nan0guy | April 7, 2012 - 22:22 | ||
|---|---|---|---|
|
Hi, I have two waves containing the x and y components of a set of vectors (representing particle trajectories) evenly spaced in time. I have scaled each wave separately by the time step, and I can determine the autocorrelation of each wave separately and these can be combined in a couple of ways, bu not to my best satisfaction. More desirable however, would be to directly determine the autocorrelation of the vectors themselves. The correlation of two vectors separated by a time lag can be determined by taking the dot product of the two vectors. Given the two waves of x and y components, how do I convert it to a vector wave (assuming that such a thing is present in Igor), then how do I determine the autocorrelation of the resulting wave? Any help is appreciated. Thanks, nan0guy |
|||

Joined: 2009-03-22
Location: Belgium
Hello nanoguy,
there is no such thing as a vector wave in Igor. There are only 1D, 2D, 3D, and 4D waves.
Which means that you will have to choose your own convention for a vector wave. I believe that in your case a reasonable option would be to use a 2D wave with two columns, and as many rows as you have vectors. For example:
x1 y1
x2 y2
x3 y3
x4 y4
... and so on.
This is purely convention: you choose that your vectors will be represented this way, but it makes no difference to Igor – Igor sees only ordinary waves.
There are a number of ways to calculate the scalar product from such a setup. For speed I'd typically recommend MatrixOP:
which will return the result in W_ScalarProduct, a wave with only 1 point.
To introduce varying time lags, take a look at the
rotateRowsandshiftVectorfunctions in the MatrixOP documentation.Joined: 2007-07-19
Location: United States
there is no such thing as a vector wave in Igor. There are only 1D, 2D, 3D, and 4D waves.
Well, there *is* the complex wave, which to my mind is at least a good *storage* format for a set of x/y vectors, even supporting conversion between cartesian and polar representations.
But yes, autocorrelation of complex waves isn't a function that's built into Igor.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.