Info

This question is closed. Reopen it to edit or answer.

Why am I getting different answers for calculating the period by autocorrelation, fft, and visual examination of data?

1 view (last 30 days)
Hi all,
I am very new to Matlab and indeed computer code in general. I am currently working on a number of examples and problems, one of which consists of a 1x300 vector of periodic data. On plotting the data, I find that it has a period of 20 samples (we do not have a sampling rate.)
On attempting autocorrelation, y=xcorr(x) and plotting y I find the graph symmetrical about the midpoint and decaying on both sides with no spikes or peaks. Surely this would suggest the data is not periodic.
Finally on performing an FFT, y=fft(x)/300 and plotting twice the absolute value of the first half of this vector squared I receive an output with a fundamental spike at 30 samples, followed by one at 60, and at 90 etc.
I assume my technique or approach is wrong as I'm fairly confident the visual inspection is correct. I know it is less than ideal as I don't have a sampling rate but I can't imagine that renders any of these approaches impossible. Why are none of the techniques lining up?
Many thanks for your help!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!