I'm trying to identify the frequencies in my time history samples, and I can see a frequency in the time history, but can't see it in its Fourier transform. Here it is :

the sample data:

dt = 0.01;(*0.01 second per sample*)

Fourier transform function:

DFT[A_, ht_] := RotateRight[ht/Sqrt[2 \[Pi]]*Fourier[RotateLeft[A, Length[A]/2 - 1], 
              FourierParameters -> {1, 1}], Length[A]/2 - 1];
(*shift the zero frequency to the center*)

plot the time history:

ListPlot[ls, PlotRange -> All, Joined -> True, DataRange -> {0, dt*Length[ls]}, Axes -> False, Frame -> True]

enter image description here

We can see there are a fast frequency with period about 0.02s and a slow frequency with period about 1.5s, but in the Fourier transform we only see the fast frequency(except the zero frequency)

ListPlot[Abs[DFT[ls, dt]]^2, PlotRange -> All, Joined -> True, DataRange -> {- 1/dt/2, 1/dt/2}, Axes -> False, Frame -> True]

enter image description here

So where is the low frequency?


As Simon and bill suggest, the slow oscillation is the beating of two close high frequencies. Since the Fourier transform resolution is 2Pi/(N*dt), where N is the number of sample points, so if I increase the resolution by increasing the number of sample points I should see two separated peaks. So I tried to increase the number of sample points, but I can only see one peak all the time. Here is how I did it:

w = 5.0; dt = 0.66125;
f[x_] := Sin[w x]

ls = Table[f[x], {x, dt, 200 dt, dt}];

we see beating in the plot

ListPlot[ls, PlotRange -> All, Joined -> True, DataRange -> {dt, 200 dt}]

enter image description here

but one on peak in the Fourier transform:

ListPlot[Abs[DFT[ls, dt]]^2, PlotRange -> All, Joined -> True, DataRange -> {-1/dt/2, 1/dt/2}, Axes -> False, Frame -> True]

enter image description here

If we increase the number of sample points, we still only see one peak:

ls2 = Table[f[x], {x, dt, 800 dt, dt}];

ListPlot[Abs[DFT[ls2, dt]]^2, PlotRange -> All, Joined -> True, DataRange -> {-1/dt/2, 1/dt/2}, Axes -> False, Frame -> True]

enter image description here

So where is the problem?

  • $\begingroup$ If you have v9, try Periodogram[ls, SampleRate -> 100]. The 0 Hz spike has distinct shoulders, but the 0.66 Hz signal cannot be disambiguated. This suggests some windowing is needed, but playing with it, I can't seem to pull it out, either. $\endgroup$
    – rcollyer
    Aug 20, 2013 at 16:34
  • 4
    $\begingroup$ I think this is more of a signal processing question than a Mathematica one. What you see in your data is beating between two high frequencies. You can completely zero the low frequencies and you'll still see it, e.g. ft = Fourier[ls]; ft[[;; 150]] *= 0; ft[[-150 ;;]] *= 0; ListLinePlot[Re[InverseFourier[ft]]] $\endgroup$ Aug 20, 2013 at 17:04
  • $\begingroup$ @SimonWoods if it is because of beating, I would expect to see two separated peaks if I increase the Fourier transform resolution, but I did't see it. See my updates. $\endgroup$ Aug 20, 2013 at 19:30
  • 1
    $\begingroup$ Sorry, I was oversimplifying. The "other" frequency peak is an alias reflected on the other side of the Nyquist frequency 1/(2dt). The beat frequency is twice the difference between your signal frequency and Nyquist fbeat = 2(w/(2Pi)-1/(2dt)) = 0.079 $\endgroup$ Aug 20, 2013 at 20:12
  • $\begingroup$ @SimonWoods does the "other" frequency really exist in the (improperly sampled) signal or not? Which is correct to say, (1) even we can see a beating in the time history, the "other" frequency may not really exist in the signal, or (2) there are two frequencies exists in the signal and we can see their beating, but we can see only one of them. And could you point me to some references of the Nyquist frequency, especially where you get "an alias reflected on the other side of the Nyquist frequency"? Thanks a lot! $\endgroup$ Aug 20, 2013 at 20:39

2 Answers 2


What is happening in your second example (with the single sine wave giving the "beating") is that you have exceeded the Nyquist frequency: what you are seeing is called aliasing. Here's a simple way to explore this (using your DFT function):

dt = 0.66125; 
f[w_, x_] := Sin[w x];
Manipulate[ls = Table[f[w, x], {x, dt, 200 dt, dt}];
   Column[{ListPlot[ls, PlotRange -> All, Joined -> True, DataRange -> {dt, 200 dt}], 
           ListPlot[Abs[DFT[ls, dt]]^2, PlotRange -> All, Joined -> True, 
           DataRange -> {-1/dt/2, 1/dt/2}, Axes -> False,  Frame -> True]}], {w, 0, 10}]

enter image description here

If you play with the slider, you'll see a single sine wave up to the Nyquist frequency (in both the time and frequency plots). When you get higher than the Nyquist frequency, the signal can do many things, among them show the beating that you noticed. Observe that the frequency line begins to descend as the frequency increases (just after you pass Nyquist). When this has certain relationships to the frequency of the sine wave, you get the beating effect.

So -- in your first question, where we could not see the source of the data (you just gave us a list of values) we had assumed you sampled correctly (i.e., below Nyquist). Simon's guess about beating was a good one. In the second question, you have created a sine wave and are sampling it improperly... there are many things that can go wrong once you do this.

  • 1
    $\begingroup$ hi; I think there is a typo: below the Nyquist rate should be above the Nyquist rate $\endgroup$
    – Nasser
    Aug 20, 2013 at 20:10
  • $\begingroup$ @Nasser -- I think I corrected it... I was improperly using "rate" and "frequency" as synonyms. $\endgroup$
    – bill s
    Aug 20, 2013 at 20:16
  • $\begingroup$ @bills I've read the reference you linked, but I'm still not quiet understand. Isn't that the Fourier transform should contains all the frequency information in the signal? How is that mathematically possible to have a beat but only one frequency? Thanks very much for your help. $\endgroup$ Aug 20, 2013 at 21:49
  • $\begingroup$ What you are thinking of is the (continuous-time) Fourier transform, which indeed would have only one frequency. Mathematica's Fourier command is the DFT (discrete Foureir transform), and if you break the Nyquist frequency, all sorts of things can happen (as you can see above). Below the Nyquist frequency, the analogy between the (continuous-time) Fourier transform and the DFT is close. Said another way, if you were sampling fast enough, this would not happen. $\endgroup$
    – bill s
    Aug 20, 2013 at 22:47

Simon has hit the problem on the head (those are not real frequency components you see). But there is a way to discover what these frequencies are, by taking the envelope of the signal and transforming (DFTing) the envelope.

data = ls - MeanFilter[ls, 5];
decay = 0.06; rise = 0.2;
filt[z_, u_] := Max[decay z + (1 - decay) u, rise z + (1 - rise) u];
env = Drop[FoldList[filt, 0, Abs[data]], 1];

The first line removes the "DC" components from the data and the following lines are a method of extracting the envelope, taken from my answer to this question. (Detail: the Drop is needed because your DFT function doesn't work for odd-length sequences).

enter image description here

Taking the DFT (using your function) of this signal env, and plotting

ListPlot[Abs[DFT[env, dt]]^2, PlotRange -> All, Joined -> True, 
      DataRange -> {-1/dt/2, 1/dt/2}, Axes -> False, Frame -> True]

enter image description here

shows the low frequency part of the signal that you are looking for.

  • $\begingroup$ Thanks! That's very helpful. But as you showed the beating frequency is about 6Hz, that means the two frequency should separated apart about 12Hz, but why it is not shown in the Fourier transform? Could you have a look at my updates? $\endgroup$ Aug 20, 2013 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.