# Discrete Fourier Transform: help on how to convert x axis in to the frequency when I have a set of data samples [duplicate]

I have a huge data set (400000 sample) and when I plot them

ListLinePlot[Au4, PlotRange -> {All, All}]


I used the following code to Fourier transform it

ListLinePlot[Abs[Fourier[Au4][[2 ;; 6000]]], PlotRange -> All,
DataRange -> {2, 6000}, PlotStyle -> Red]


And got this

My problem is how to convert the x axis here in to the frequency domain in Mathematica? I saw that I can use the DataRange for that but I could not figure out how to do that exactly. I failed all the attempts. (I also saw that I can only use Fourier to the sample data only but I don't understand what is resulted in X axis after doing the Fourier to samples) Can someone help me at this point?

## marked as duplicate by Sjoerd C. de Vries, MarcoB, user9660, m_goldberg, Jason B.Feb 2 '16 at 9:02

• There were quite a few similar questions on this site. For instance 44237 and 33149. Also, have a look at the built-in Periodogram with option SampleRate – Sjoerd C. de Vries Feb 1 '16 at 19:01
• In addition to those suggested by @SjoerdC.deVries, I'd suggest Hugh's answer to this question on the same topic: What do the X and Y axis stand for in the Fourier transform domain?. I found itwell-written and very educational. – MarcoB Feb 1 '16 at 19:07
• Thanks a lot for you help.Really appreciate that. – ravi3 Feb 2 '16 at 3:41
• – mrz Feb 3 '16 at 9:23

Based on the above referenced (and unreferenced) answers on mathematica.stackexchange, here is a short version of running code:

data=Au4;                      (* input *)
timeInterval = 10;             (* input *)
nSamples = Length@data;

dt=timeInterval/nSamples;
spectrumLength = Floor[0.5 nSamples];
powerSpectralDensity = Abs[Fourier[signal][[;; spectrumLength]]]^2;
freqs = Range[0, spectrumLength - 1]/(dt*nSamples);
plot = ListLogLogPlot[Transpose[{freqs,powerSpectralDensity}]]


Seeing is believing, so here is the code applied to a simple sine wave:

• Frequency is 0.5.
• Duration of sampled time interval is 20.
• Number of discrete samples in interval is 1000.

Code:

nSamples=1000;
timeInterval=20.0;
dt=timeInterval/nSamples;
f=0.5;
signal=Table[Sin[2.0 Pi f t dt],{t,nSamples}];

spectrumLength=Round[0.5 nSamples];