Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I have a signal F(t) which represents a excitation by a pulse (so it is not periodic and declining to zero amplitude). According to this answer, for instance, Fourier[Data] in Mathematica assumes otherwise.

How can I can specify that the data is not periodic so I can get the correct spectrum?

share|improve this question
With FFT, the usual trick is to take a time interval far longer than the transient. The FFT algorithm is so efficient that this is not a waste of computing capabilities. Of course the transient must decline to negligible values. – andre Apr 8 '13 at 23:43
up vote 3 down vote accepted

When you say "it is not periodic and declining to zero", I assume you mean "and NOT declining to zero".

For a non-periodic transient you can pad with background values, zeros in your case, so that the total number of points equals a large power of 2. The FFT of this extended signal is still blindingly fast, and the result approximates the frequency spectrum of an isolated transient.

However(!), if your transient has NOT declined to zero, then the FFT will introduce artificial amplitudes at all frequencies because of the step function from the end of the measured transient suddenly down to zero. The resulting frequency spectrum is now contaminated with a non-constant baseline offset.

It would be best if you could measure the full decline of the excitation down to background (zero) values, then pad with zeros...

share|improve this answer

The FFT is based on the assumption that the signal is periodic. The basic period is the length of the input: a sinusoid that fits exactly once into this length is the lowest possible frequency. Let's call this frequency f. The FFT is a formula that shows how the signal (in this case your pulse) can be written as a weighted sum of (complex-valued) sinusoidal terms that are integer multiples of this f. So what you are doing when you apply the FFT to something like a pulse waveform is you are pretending that the pulse is one of an infinite stream of identical pulses. The spectrum you get from the FFT is the spectrum of this infinitely-extended waveform. Here's a post showing many of the details of this procedure in the case where the signal is derived from a .wav file.

How to approximate a given WAV file with trigonometric series?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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