I am testing Mathematica's DFT algorithm using one of the test cases provided in the documentation, of a noisy sine function with a frequency of 0.15 cycles per sample:
FourierTestData[n_] := Table[N[Sin[30 2 Pi x/200] + (RandomReal[] - 1/2)], {x, n}]
I find the estimated period according to the FFT:
Frequency[data_] := TakeLargest[Drop[Abs[Fourier[data, FourierParameters -> {-1, 1}]], -Round[Length[data]/2]] -> {"Index"}, 1];
I test this method across a range of numbers of points (without changing the period or any other parameters), like so:
Table[{i*200, First[First[Period[FourierTestData[i*200]]]]}, {i, 1, 200, 0.1}]
I find that the reported frequency is equal to the actual frequency times the number of points, i.e. the length of the test sequence. Why would this be the case?
a[[i]]
represents a frequency ofi-1
cycles per total length of the input sequence. This is implicit in the definition of the DFT, reflected in the detailed definition in the Mathematica documentation. $\endgroup$Fourier
here . The notes explain how to generate a frequency axis. $\endgroup$