# Why does the reported primary frequency with Mathematica's discrete Fourier transform scale with the length of the input signal?

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?

• For the discrete Fourier transform, the complex amplitude a[[i]] represents a frequency of i-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. Nov 4, 2021 at 0:20
• I have put some notes on how Mathematica implements Fourier here . The notes explain how to generate a frequency axis.
– Hugh
Nov 4, 2021 at 6:45

As per Hugh and John's comments, this is because in a discrete Fourier transform, the frequency represented by the n-th point (in cycles/sample) is equal to (n-1)/N, where N is the total number of points.