I have some periodic data, but the amount of data is not a multiple of the Period. How can I Fourier analyze this data? Example:
% Let me create some test data:
data = Table[N[753+919*Sin[x/623-125]], {x,1,25000}]
% Now I get this data, but I donβt know that it came from the formula above. I am trying to recover a formula only from "data".
% Looking at the first few non-constant members of the Fourier series:
ListPlot[Table[Abs[Fourier[data]][[x]], {x,2,20}], PlotJoined->True, PlotRange->All]

shows the expected surge of 6 (since the number of periods is really 25000 / (623 * 2 * Pi) or about 6.38663, although we do not know this).
% Now, how do I return 6.38663? One way is to crush data using arbitrary multiples of Cos [x].
convolve[n_] := Sum[data[[x]]*Cos[n*x], {x,1,25000}]
% And draw a "convolution" around n = 6:
Plot[convolve[n],{n,5,7}, PlotRange->All]

we see a surge somewhere where it was expected.
% We will try FindMaximum:
FindMaximum[convolve[n],{n,5,7}]
but the result is useless and inaccurate:
FindMaximum::fmmp: Machine precision is insufficient to achieve the requested accuracy or precision. Out[119]= {98.9285, {n -> 5.17881}}
because the function is very wiggly.
% Refining our interval (using visual analysis on graphs), we finally find the interval in which convolve [] does not vibrate too much:
Plot[convolve[n],{n,6.2831,6.2833}, PlotRange->All]

and FindMaximum works:
FindMaximum[convolve[n],{n,6.2831,6.2833}]
% However, this process is ugly, requires human intervention, and calculating convolve [] is REALLY slow. Is there a better way to do this?
% Looking at the Fourier series of data, can I somehow God the "True" number of periods is 6.38663? Of course, the actual result will be 6.283185, since my data is better suited (because I am only sampling at a finite number of points).