# Periodicity of data

I have some real data (data packets in a router). When I plot it I can see there is a clear periodicity on the dataset (24hours+-).

But how can I discover the periodicity of the data without being by approximation, and possible check other periodicities?

What I am trying to do:

I thought I just had to do the the Fourier transform and then see what were the higher frequencies (one should be around 24).

When I do this in octave and then plot the graphic only garbage comes out.

plot(fft(data))

What am I doing wrong?

-
Try the square of the absolute value of the FFT. –  Steve Huntsman Feb 23 '10 at 21:53
If the period itself varies slightly this might not be accurately reflected in the FFT. You might try shifting around your data so that some particular distinguished peak of activity is always at the same time every day and then try it again. –  Qiaochu Yuan Feb 24 '10 at 0:03
Just to emphasize what Steve Huntsman said: You are probably trying to plot complex data. In matlab notation, try to replace plot(fft(x)) by plot(abs(fft(x))), or plot(abs(fft(x)).^2) –  user2734 Feb 24 '10 at 7:58
You may also try to plot wavelet transform (Scilab has this functionality ), which in case of non stationary and non filtered (for example do You check and remove trends? is thee some constant background signal in Your data - I presume YES!) data may be much more interesting and informative. It should give You information about frequencies related to certain time intervals ( data in period window of hours may be non-periodic, whilst when averaged on days has to have visible frequencies). Using FFT on non filtered data ( non averaged, trends removed rtc) may give You garbage outputs. –  kakaz Feb 24 '10 at 8:46

Why don't you try autocorrelation?

See Wikipedia:

http://en.wikipedia.org/wiki/Autocorrelation

Excerpt: "Autocorrelation is the cross-correlation of a signal with itself. Informally, it is the similarity between observations as a function of the time separation between them. It is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal which has been buried under noise, or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time domain signals."

-

Hi,

try following Matlab Tech Notes on proper rescaling/shifting of fft output to get meaningful power spectrum of a signal. Octave seems to be pretty close to Matlab in syntax and basic commands so you shouldn't have too much problem adapting the tutorial to your software.

-