2
$\begingroup$

I have a list (list) in the form of {x,y} as

list = {{0., 16}, {0.00392157, 19}, {0.00784314, 6}, {0.0117647, 
  5}, {0.0156863, 8}, {0.0196078, 5}, {0.0235294, 6}, {0.027451, 
  7}, {0.0313725, 4}, {0.0352941, 10}, {0.0392157, 7}, {0.0431373, 
  9}, {0.0470588, 8}, {0.0509804, 11}, {0.054902, 9}, {0.0588235, 
  15}, {0.0627451, 10}, {0.0666667, 13}, {0.0705882, 16}, {0.0745098, 
  21}, {0.0784314, 24}, {0.0823529, 20}, {0.0862745, 25}, {0.0901961, 
  19}, {0.0941176, 24}, {0.0980392, 27}, {0.101961, 22}, {0.105882, 
  23}, {0.109804, 29}, {0.113725, 28}, {0.117647, 28}, {0.121569, 
  37}, {0.12549, 41}, {0.129412, 44}, {0.133333, 41}, {0.137255, 
  44}, {0.141176, 43}, {0.145098, 22}, {0.14902, 50}, {0.152941, 
  39}, {0.156863, 59}, {0.160784, 48}, {0.164706, 58}, {0.168627, 
  45}, {0.172549, 56}, {0.176471, 52}, {0.180392, 70}, {0.184314, 
  53}, {0.188235, 61}, {0.192157, 61}, {0.196078, 58}, {0.2, 
  41}, {0.203922, 47}, {0.207843, 53}, {0.211765, 59}, {0.215686, 
  54}, {0.219608, 58}, {0.223529, 63}, {0.227451, 55}, {0.231373, 59},
  {0.235294, 77}, {0.239216, 72}, {0.243137, 66}, {0.247059, 
  70}, {0.25098, 53}, {0.254902, 61}, {0.258824, 67}, {0.262745, 
  58}, {0.266667, 54}, {0.270588, 51}, {0.27451, 57}, {0.278431, 
  62}, {0.282353, 57}, {0.286275, 63}, {0.290196, 59}, {0.294118, 
  64}, {0.298039, 50}, {0.301961, 46}, {0.305882, 52}, {0.309804, 
  58}, {0.313725, 51}, {0.317647, 39}, {0.321569, 63}, {0.32549, 
  54}, {0.329412, 41}, {0.333333, 48}, {0.337255, 48}, {0.341176, 
  47}, {0.345098, 56}, {0.34902, 42}, {0.352941, 65}, {0.356863, 
  46}, {0.360784, 36}, {0.364706, 45}, {0.368627, 41}, {0.372549, 
  43}, {0.376471, 34}, {0.380392, 43}, {0.384314, 37}, {0.388235, 
  40}, {0.392157, 34}, {0.396078, 32}, {0.4, 32}, {0.403922, 
  50}, {0.407843, 40}, {0.411765, 31}, {0.415686, 34}, {0.419608, 
  45}, {0.423529, 37}, {0.427451, 28}, {0.431373, 44}, {0.435294, 
  28}, {0.439216, 32}, {0.443137, 24}, {0.447059, 24}, {0.45098, 
  28}, {0.454902, 34}, {0.458824, 38}, {0.462745, 36}, {0.466667, 
  25}, {0.470588, 31}, {0.47451, 15}, {0.478431, 24}, {0.482353, 
  27}, {0.486275, 20}, {0.490196, 24}, {0.494118, 31}, {0.498039, 
  19}, {0.501961, 11}, {0.505882, 25}, {0.509804, 25}, {0.513725, 
  32}, {0.517647, 17}, {0.521569, 17}, {0.52549, 21}, {0.529412, 
  25}, {0.533333, 16}, {0.537255, 16}, {0.541176, 20}, {0.545098, 
  17}, {0.54902, 17}, {0.552941, 16}, {0.556863, 19}, {0.560784, 
  22}, {0.564706, 14}, {0.568627, 18}, {0.572549, 16}, {0.576471, 
  20}, {0.580392, 12}, {0.584314, 15}, {0.588235, 17}, {0.592157, 
  5}, {0.596078, 17}, {0.6, 11}, {0.603922, 19}, {0.607843, 
  6}, {0.611765, 8}, {0.615686, 9}, {0.619608, 10}, {0.623529, 
  10}, {0.627451, 9}, {0.631373, 9}, {0.635294, 5}, {0.639216, 
  5}, {0.643137, 7}, {0.647059, 9}, {0.65098, 7}, {0.654902, 
  7}, {0.658824, 10}, {0.662745, 5}, {0.666667, 6}, {0.670588, 
  6}, {0.67451, 6}, {0.678431, 4}, {0.682353, 8}, {0.686275, 
  6}, {0.690196, 3}, {0.694118, 2}, {0.698039, 8}, {0.701961, 
  3}, {0.705882, 6}, {0.709804, 5}, {0.713725, 3}, {0.717647, 
  1}, {0.721569, 3}, {0.72549, 1}, {0.729412, 5}, {0.733333, 
  1}, {0.737255, 1}, {0.741176, 2}, {0.745098, 2}, {0.74902, 
  3}, {0.752941, 2}, {0.756863, 1}, {0.760784, 1}, {0.764706, 
  2}, {0.768627, 1}, {0.776471, 1}, {0.784314, 1}, {0.788235, 
  1}, {0.792157, 1}, {0.8, 1}, {0.807843, 1}, {0.827451, 
  1}, {0.835294, 1}, {0.870588, 1}};

Since the x values are not equally spaced, I am not sure whether I can extract the frequency components using Fourier.

How can I find the frequency components present in the list?

$\endgroup$
5
  • $\begingroup$ Try to interpolate your data in an equally spaced grid, now you can calculate the FourierSeries. Or you can approximate(least square) your data by a trigonometric polynom... $\endgroup$ May 25, 2018 at 13:50
  • $\begingroup$ @UlrichNeumann Yes, I thought about interpolation. Are there any other alternatives? $\endgroup$
    – user36426
    May 25, 2018 at 13:55
  • 1
    $\begingroup$ I think interpolation is the fastest way(see Hugh's answer). What's your purpose using FourierSeries for your data which doesn't look "periodic"? $\endgroup$ May 25, 2018 at 14:02
  • $\begingroup$ @UlrichNeumann I have a set of such lists and I want to compare them by looking at their frequency contents. $\endgroup$
    – user36426
    May 25, 2018 at 14:06
  • $\begingroup$ See also: en.wikipedia.org/wiki/Non-uniform_discrete_Fourier_transform $\endgroup$ May 26, 2018 at 16:20

1 Answer 1

2
$\begingroup$

Here is a way using Interpolation.

f = Interpolation[list];
{x1, x2} = list[[All, 1]][[{1, -1}]];
inc = (x2 - x1)/(Length[list] - 1);

Then your list with equal x increments is

newList = Table[{x, f[x]}, {x, x1, x2, inc}];
ListLinePlot[{list, newList}]

Mathematica graphics

Is the newList a good enough approximation for you? It looks very noisy. Also it does not have a definite periodic content so I don't know the purpose of using Fourier. Is this for smoothing? Anyway

ft = Fourier[newList[[All, 2]], FourierParameters -> {-1, -1}];
ListLinePlot[Abs[ft]]

Mathematica graphics

See here for notes on using Fourier and getting axes etc.

Hope that helps.

$\endgroup$

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.