# Finding if data in array is periodic

I have a very large array (about 500.000 in size). I've plotted the array in chunks and founded at the tail of the array there is a periodic behavior, so I want to know if there is a way to know if it is periodic an if so what is its period?

I don't have any idea about signal processing so I need to know if there is a simple and straight forward method to check it. I'm using Python and Mathlab.

Thanks!

• You can try pwelch in Matlab. You should try to bound the range of periods you think might be present in your array because you want a DFT size that contains enough cycles and a rule-of thumb should be around 10 periods. – Stanley Pawlukiewicz Nov 19 '17 at 15:50

Mathematically, what you probably want is the autocorrelation function. That function is a function on a function over time or a sequence, which gives you info about how similar your signal is to itself when shifted by shift $\tau$.
If your signal is periodic with period $\tau$, then it will be very similar to itself when shifted by $\tau$, $2\tau$, $3\tau$, and so on. So, you'll get $\tau$-periodic peaks in your autocorrelation function
A very common thing to do is to look at the Power Spectral Density (PSD), which is, in fact, the Fourier transform of the autocorrelation function. You can, however, in your sampled case, calculate the PSD directly by Fourier-transforming (Matlab function fft) your sequence and finding the abs² of it. The peaks correspond to periodicities.
• This one. You really don't need more examples. You need how to use Matlab, and you need how to use the fft function (which is really just fft(data)), and you need to be able to plot things. – Marcus Müller Nov 19 '17 at 18:15