2
$\begingroup$

I have a data set consisting of measurements of an $n$-dimensional vector $\mathbf{x}(t)$, at $N$ distinct time points $t_i$. The time points $t_i$ are equally spaced.

I need to find the dominant periodicities of this data. That is, I need to estimate a value of $T$ such that $\mathbf{x}(t)$ and $\mathbf{x}(t + T)$ are similar throughout the data (maybe there are multiple such "dominant periodicities" $T$).

How can I do this in Mathematica?

$\endgroup$
  • 1
    $\begingroup$ Look at the peaks of Total /@ ListCorrelate[data, data, 1]? $\endgroup$ – Rahul Dec 22 '14 at 14:20
  • $\begingroup$ The new MMA function FunctionPeriod might be of help. $\endgroup$ – bbgodfrey Dec 22 '14 at 14:32
3
$\begingroup$

Since the vector itself has a periodicity, then the individual scalar components should also have the same periodicity. So, if we FT one of the scalar components, it's FT should have peaks at the dominant frequencies. Or, for added signal to noise ratio, we can add the squares of the absolute values of the FT's of the components in time.

As an example, here's a vector with a period of 1.3, plus random noise:

Δt = 0.2;
T = 3000.;
list = Table[
   Sin[2 π t/1.3 + 2.8] {1, 2, -3, 4} + 
    RandomReal[{-0.5, 0.5}, 4], {t, Δt, T, Δt}];

Now take the FT of the individual components in time, absolute value them, square them, and add them, and plot:

ftlist = Plus @@ (Abs[Fourier /@ (list\[Transpose])]^2);
ListLinePlot[ftlist, PlotRange -> All]

enter image description here

Now, convert the peak index into period, recovering the 1.3 we originally used (up to quantization error):

T/(Last[Ordering[ftlist[[1 ;; 4000]]]] - 1)
(*1.29983*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.