There is a function in mathematica FourierCoefficient for finding fourier coefficients of a periodic function, but it requires the mathematical expression as input. What if I don't have such mathematica expression, but I have the coordinate points of the curve for one period?

Suppose I have the following coordinate points for a curve that looks approximately like a sine curve:


t is the parameter for the parametric curves, and x,y are the corresponding coordinates, so the coordinates are actually (x1,y1),(x1,y1),(x1,y1). It is also periodic in the y-direction, so the x-coordinates will vary between two values. How do I find the fourier coefficients for such a periodic curve?



So after doing some rotation and translation to my curve, I get the following. I then follow the online tutorial on DFT in Mathematica: enter image description here.

The plot makes sense to me, but how do I extract various fourier coefficients from the second plot? Basically what I want to do is to compare the magnitude of various fourier coefficients to determine how closely it resembles a sine/cosine curve, so I really need to the fourier coefficients.

  • 2
    $\begingroup$ Can you please generate a minimal data set for experimentation. $\endgroup$
    – yarchik
    Commented Aug 26, 2016 at 10:35

1 Answer 1


One thing you can do is to generate the complex-number sequence {{x1+Iy1}, {x2+Iy2}...} and then use Fourier. This is sometimes called the "Fourier Descriptor" and there is a demonstration at demonstrations.wolfram.com/FourierDescriptors

Here's a simple example. First, make up some data that form a parametric plot

x = Table[Sin[t], {t, -10, 10, 0.1}];
y = Table[t^2, {t, -3, 3, 0.03}];
ListLinePlot[Thread[{x, y}]]

enter image description here

Now take the DFT of the sequence:

Fourier[x + I y]

You will probably want to look at the help file for Fourier to get the best set of options.

You can get your original curve back using the inverse DFT... InverseFourier. This gives you a list of complex numbers which you then interpret as the x and y coordinates for your parametric plot. Continuing the above example:

invz = InverseFourier[z];
ListLinePlot[Thread[{Re[invz], Im[invz]}]]

returns exactly the same plot. If you leave out some of the higher frequency values in invz, you get a low pass filtering (smoothing) of the parametrized curve.

  • $\begingroup$ But once I have the DFT (a list of complex numbers), how do I recover the original curve using them? $\endgroup$
    – Physicist
    Commented Aug 26, 2016 at 13:14
  • $\begingroup$ See update describing the inversion procedure. $\endgroup$
    – bill s
    Commented Aug 26, 2016 at 13:23
  • $\begingroup$ thx. I have modified the question to clarify what I want to achieve. $\endgroup$
    – Physicist
    Commented Aug 26, 2016 at 20:54
  • $\begingroup$ Your revised question makes little sense. The Fourier coefficients are precisely the values in the lists Abs[Fourier[ ] ]. $\endgroup$
    – bill s
    Commented Aug 26, 2016 at 21:13
  • $\begingroup$ I know, but the second plot shows the fourier coefficient when it is expressed in terms of complex number. I know how to convert it into fourier coefficients in terms of sine/cosine, but when I first look at the plot it doesn't even make sense to me. I tried interpolation and then do the numerical integration explicitly to calculate the first 10 fourier coefficients for sine and cosine. The first coefficient for sine dominates (orders of mag. larger than others), which seems reasonable based on how the curve looks. But the 2nd plot shows a significant frequency of 300+, what does that mean? $\endgroup$
    – Physicist
    Commented Aug 27, 2016 at 8:59

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