Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have list of data and its plot and I don't know how to fit the plot with fourier series of either sine or cosine.

Full Data:


{{0., -0.176091}, {0.034, -0.163291}, {0.067, -0.156391}, {0.1,
-0.152791}, {0.134, -0.149391}, {0.167, -0.144791}, {0.2, -0.141291}, 
{0.234, -0.135991}, {0.267, -0.126191}, {0.301, -0.123591}, {0.334, 
-0.113091}, {0.367, -0.108991}, {0.401, -0.0985909}, {0.434, 
-0.0929909}, {0.467, -0.0891909}, {0.501, -0.0831909}, {0.534, 
-0.0748909}, {0.567, -0.0667909}, {0.601, -0.0666909}, {0.634,
-0.0679909}, {0.668, -0.0678909}, {0.701, -0.0731909}, {0.734, 
-0.0735909}, {0.768, -0.0720909}, {0.801, -0.0690909}, {0.834, 
-0.0689909}, {0.868, -0.0634909}, {0.901, -0.0585909}, {0.934, 
-0.0551909}, {0.968, -0.0534909}, {1.001, -0.0486909}, {1.035, 
-0.0470909}, {1.068, -0.0449909}, {1.101, -0.0424909}, {1.135,
-0.0426909}, {1.168, -0.0407909}, {1.201, -0.0404909}, {1.235, 
-0.0379909}, {1.268, -0.0379909}, {1.301, -0.0387909}, {1.335, 
-0.0422909}, {1.368, -0.0441909}, {1.402, -0.0480909}, {1.435,
-0.0532909}, {1.468, -0.0636909}, {1.502, -0.0672909}, {1.535, 
-0.0740909}, {1.569, -0.0825909}, {1.602, -0.0927909}, {1.635, 
-0.102191}, {1.669, -0.108991}, {1.702, -0.120491}, {1.736, 
-0.134691}, {1.769, -0.139191}, {1.802, -0.152791}, {1.836, 
-0.168791}, {1.869, -0.182891}, {1.902, -0.191091}, {1.936,
-0.198991}, {1.969, -0.219991}, {2.002, -0.236191}, {2.035, 
-0.243891}, {2.069, -0.255391}, {2.102, -0.268591}, {2.136, 
-0.281391}, {2.169, -0.292691}, {2.202, -0.296891}, {2.236, 
-0.313391}, {2.269, -0.323991}, {2.302, -0.334691}, {2.337,
-0.342691}, {2.369, -0.352291}, {2.402, -0.359091}, {2.436, 
-0.367891}, {2.469, -0.372091}, {2.502, -0.375991}, {2.536, 
-0.377191}, {2.569, -0.376691}, {2.603, -0.377891}, {2.636, 
-0.377191}, {2.669, -0.369691}, {2.703, -0.361491}, {2.736, 
-0.349791}, {2.769, -0.341491}, {2.803, -0.338591}, {2.837, 
-0.333591}, {2.869, -0.321591}, {2.903, -0.311191}, {2.936, 
-0.303291}, {2.97, -0.289291}, {3.003, -0.284691}, {3.036,
-0.279691}, {3.07, -0.259491}, {3.103, -0.247591}, {3.136, 
-0.244791}, {3.17, -0.236991}, {3.203, -0.231191}, {3.236, 
-0.215191}, {3.27, -0.201091}, {3.303, -0.194591}, {3.337, 
-0.187891}, {3.37, -0.182991}, {3.403, -0.173591}, {3.437, 
-0.160891}, {3.47, -0.157091}, {3.503, -0.150791}, {3.537,-0.142991}, {3.57, -0.137591}, {3.604, -0.131591}, {3.637, 
-0.116991}, {3.67, -0.108091}, {3.704, -0.101591}, {3.737, 
-0.101591}, {3.77, -0.101591}, {3.804, -0.100291}, {3.837, 
-0.104591}, {3.87, -0.112991}, {3.904, -0.122591}, {3.937, 
-0.137291}, {3.971, -0.146891}, {4.004, -0.157091}, {4.037, 
-0.173491}, {4.071, -0.190691}, {4.104, -0.202191}, {4.137, 
-0.219491}, {4.171, -0.231491}, {4.204, -0.238291}, {4.238, 
-0.247191}, {4.271, -0.264391}, {4.305, -0.281991}, {4.338, 
-0.285991}, {4.371, -0.288691}, {4.404, -0.302691}, {4.438,
-0.310891}, {4.471, -0.319791}, {4.504, -0.325891}, {4.538,
-0.330891}, {4.571, -0.333291}, {4.605, -0.338791}, {4.638, 
-0.351091}, {4.671, -0.359491}, {4.705, -0.363591}, {4.738, 
-0.370191}, {4.771, -0.378591}, {4.805, -0.385291}, {4.838, 
-0.393591}, {4.871, -0.403191}, {4.905, -0.410791}, {4.938, 
-0.420591}, {4.972, -0.425491}, {5.005, -0.429491}, {5.038, 
-0.428791}, {5.072, -0.423291}, {5.105, -0.411891}, {5.138, 
-0.402391}, {5.172, -0.392591}, {5.205, -0.381591}, {5.239, 
-0.371091}, {5.272, -0.353891}, {5.305, -0.341791}, {5.339, 
-0.335791}, {5.372, -0.325091}, {5.405, -0.309291}, {5.439, 
-0.301791}, {5.472, -0.296091}, {5.505, -0.289291}, {5.539, 
-0.284391}, {5.572, -0.275991}, {5.606, -0.266891}, {5.639, 
-0.259291}, {5.672, -0.251191}, {5.706, -0.242291}, {5.739, 
-0.233391}, {5.773, -0.221291}, {5.806, -0.207391}, {5.839, 
-0.196291}, {5.873, -0.192791}, {5.906, -0.185991}, {5.939, 
-0.176191}, {5.973, -0.165291}, {6.006, -0.152591}, {6.039,
-0.148691}, {6.073, -0.136091}, {6.106, -0.127591}, {6.14, 
-0.119391}, {6.173, -0.113891}, {6.206, -0.106791}, {6.24, 
-0.0938909}, {6.273, -0.0782909}, {6.306, -0.0742909}, {6.34, 
-0.0710909}, {6.373, -0.0606909}, {6.406, -0.0489909}, {6.44, 
-0.0412909}, {6.473, -0.0289909}, {6.506, -0.0232909}, {6.54, 
-0.0150909}, {6.573, -0.00669086}, {6.607, 0.00140914}, {6.64, 
  0.00980914}, {6.673, 0.0133091}, {6.707, 0.0205091}, {6.74, 
  0.0226091}, {6.773, 0.0255091}, {6.807, 0.0254091}, {6.84, 
  0.0259091}, {6.874, 0.0250091}, {6.907, 0.0299091}, {6.94, 
  0.0401091}, {6.974, 0.0428091}, {7.007, 0.0410091}, {7.04, 
  0.0410091}, {7.074, 0.0406091}, {7.107, 0.0370091}, {7.141, 
  0.0326091}, {7.174, 0.0246091}, {7.207, 0.0196091}, {7.241, 
  0.0131091}, {7.274, 
  0.00230914}, {7.307, -0.00419086}, {7.341, -0.0222909}, {7.374, 
-0.0349909}, {7.408, -0.0534909}, {7.441, -0.0693909}, {7.474, 
-0.0898909}, {7.508, -0.103991}, {7.541, -0.121191}, {7.574, 
-0.133891}, {7.608, -0.142891}, {7.641, -0.156591}, {7.674, 
-0.173991}, {7.708, -0.188791}, {7.741, -0.197691}, {7.775, 
-0.205891}, {7.808, -0.222291}, {7.841, -0.228991}, {7.875, 
-0.234191}, {7.908, -0.240591}, {7.941, -0.245191}, {7.975, 
-0.254191}, {8.008, -0.265391}, {8.041, -0.271791}, {8.075, 
-0.277791}, {8.108, -0.283791}, {8.142, -0.284791}, {8.175, 
-0.286991}, {8.208, -0.299891}, {8.242, -0.307491}, {8.275, 
-0.309591}, {8.308, -0.314391}, {8.342, -0.321791}, {8.375, 
-0.324191}, {8.409, -0.324691}, {8.442, -0.324191}, {8.475, 
-0.317291}, {8.509, -0.308491}, {8.542, -0.296091}, {8.575, 
-0.287691}, {8.609, -0.283691}, {8.642, -0.275491}, {8.675, 
-0.271491}, {8.709, -0.268991}, {8.742, -0.256991}, {8.776, 
-0.246491}, {8.809, -0.244191}, {8.842, -0.240491}, {8.876, 
-0.233391}, {8.909, -0.226791}, {8.942, -0.211891}, {8.976, 
-0.198891}, {9.009, -0.195791}, {9.042, -0.191491}, {9.076, 
-0.185791}, {9.109, -0.177791}, {9.143, -0.169491}, {9.176, 
-0.163891}, {9.209, -0.149591}, {9.243, -0.144191}, {9.276, 
-0.139191}, {9.309, -0.127391}, {9.343, -0.113491}, {9.376, 
-0.108791}, {9.41, -0.0967909}, {9.443, -0.0905909}, {9.476, 
-0.0789909}, {9.51, -0.0755909}, {9.543, -0.0740909}, {9.576, 
-0.0666909}, {9.61, -0.0640909}, {9.643, -0.0581909}, {9.676, 
-0.0575909}, {9.71, -0.0627909}, {9.743, -0.0715909}, {9.776, 
-0.0876909}, {9.81, -0.0975909}, {9.843, -0.107691}, {9.877, 
-0.130391}, {9.91, -0.140491}, {9.943, -0.152091}, {9.977, 
-0.159191}, {10.01, -0.160591}, {10.044, -0.185091}, {10.077, 
-0.215291}, {10.11, -0.243091}, {10.144, -0.264791}, {10.177, 
-0.272491}, {10.21, -0.272791}, {10.244, -0.262091}, {10.277, 
-0.247391}, {10.31, -0.243391}, {10.344, -0.239291}, {10.377, 
-0.234891}, {10.411, -0.233991}, {10.444, -0.233691}, {10.477, 
-0.203691}, {10.511, -0.157191}, {10.544, -0.148491}, {10.577, 
-0.148491}, {10.611, -0.148691}, {10.644, -0.143591}, {10.678, 
-0.133091}, {10.711, -0.123391}, {10.744, -0.116991}, {10.778, 
-0.111891}, {10.811, -0.101491}, {10.845, -0.0897909}, {10.878, 
-0.0858909}, {10.911, -0.0777909}, {10.945, -0.0730909}, {10.978, 
-0.0731909}, {11.011, -0.0639909}, {11.045, -0.0559909}, {11.078, 
-0.0469909}, {11.111, -0.0414909}, {11.145, -0.0336909}, {11.178, 
-0.0258909}, {11.211, -0.0174909}, {11.245, -0.00539086}, {11.278, 
-0.00059086}, {11.312, 0.00330914}, {11.345, 0.00680914}, {11.378, 
  0.0155091}, {11.412, 0.0215091}, {11.445, 0.0219091}, {11.478, 
  0.0266091}, {11.512, 0.0286091}, {11.545, 0.0297091}, {11.58, 
  0.0274091}, {11.612, 0.0239091}, {11.645, 0.0172091}, {11.679, 
  0.0113091}, {11.712, 0.0100091}, {11.746, 0.00680914}, {11.779, 
  0.00770914}, {11.812, 0.00470914}, {11.846, 0.00280914}, {11.879, 
  0.00370914}, {11.912, 0.00490914}, {11.946, 0.00140914}, {11.979, 
  0.00130914}, {12.013, 0.00450914}, {12.046, 0.00850914}, {12.079, 
  0.00830914}, {12.113, 0.00660914}, {12.146, 0.00930914}, {12.18, 
  0.0105091}, {12.213, 0.00980914}, {12.246, 0.00700914}, {12.279, 
  0.00520914}, {12.313, -0.0000908604}, {12.346, 0.00330914}, {12.38, 
  0.00560914}, {12.413, 0.00620914}, {12.446, 0.0191091}, {12.48, 
  0.0241091}, {12.513, 0.0242091}, {12.546, 0.0250091}, {12.58, 
  0.0318091}, {12.613, 0.0332091}, {12.646, 0.0370091}, {12.68, 
  0.0361091}, {12.713, 0.0374091}, {12.747, 0.0370091}, {12.78, 
  0.0379091}, {12.813, 0.0399091}, {12.847, 0.0394091}, {12.88, 
  0.0386091}, {12.914, 0.0379091}, {12.947, 0.0386091}, {12.98, 
  0.0413091}, {13.013, 0.0431091}, {13.047, 0.0459091}, {13.08, 
  0.0466091}, {13.114, 0.0436091}, {13.147, 0.0419091}, {13.181, 
  0.0427091}, {13.214, 0.0436091}, {13.247, 0.0394091}, {13.28, 
  0.0378091}, {13.314, 0.0341091}, {13.347, 0.0224091}, {13.38, 
  0.0180091}, {13.414, 0.00960914}, {13.448, 
  0.00410914}, {13.481, -0.00819086}, {13.514, -0.0264909}, {13.547, 
-0.0456909}, {13.581, -0.0626909}, {13.614, -0.0694909}, {13.648, 
-0.0821909}, {13.681, -0.0941909}, {13.714, -0.113991}, {13.748, 
-0.132791}, {13.781, -0.143691}, {13.814, -0.150791}, {13.848, 
-0.162191}, {13.881, -0.178391}, {13.915, -0.189691}, {13.948, 
-0.195791}, {13.981, -0.203191}, {14.015, -0.223491}, {14.048, 
-0.230991}, {14.081, -0.238491}, {14.115, -0.246791}, {14.148, 
-0.263591}, {14.182, -0.278591}, {14.215, -0.291291}, {14.248, 
-0.296291}, {14.281, -0.300191}, {14.315, -0.298991}, {14.348, 
-0.300991}, {14.381, -0.295691}, {14.415, -0.290191}, {14.448, 
-0.280791}, {14.482, -0.275191}, {14.515, -0.263791}, {14.548, 
-0.251391}, {14.582, -0.239491}, {14.615, -0.231591}, {14.648, 
-0.222991}, {14.682, -0.208491}, {14.715, -0.195791}, {14.748, 
-0.188491}, {14.782, -0.182491}, {14.816, -0.177191}, {14.849, 
-0.165491}, {14.882, -0.155491}, {14.916, -0.146391}, {14.949, 
-0.136891}, {14.982, -0.135591}, {15.015, -0.131191}, {15.049, 
-0.122891}, {15.082, -0.117491}, {15.116, -0.116591}, {15.149, 
-0.117291}, {15.182, -0.121291}, {15.216, -0.123791}, {15.249, 
-0.131291}, {15.282, -0.137891}, {15.316, -0.149291}, {15.35, 
-0.162091}, {15.383, -0.177391}, {15.416, -0.189691}, {15.449, 
-0.201891}, {15.483, -0.214291}, {15.516, -0.225291}, {15.549, 
-0.227691}, {15.583, -0.225691}, {15.616, -0.223491}, {15.65, 
-0.230191}, {15.683, -0.246191}, {15.717, -0.275491}, {15.75, 
-0.296991}, {15.783, -0.311691}, {15.817, -0.289291}, {15.85, 
-0.272091}, {15.883, -0.270291}, {15.916, -0.281991}, {15.95, 
-0.261391}, {15.983, -0.233891}, {16.017, -0.231791}, {16.05, 
-0.234491}, {16.083, -0.220791}, {16.117, -0.185091}, {16.15, 
-0.172991}, {16.183, -0.177391}, {16.217, -0.178591}, {16.25, 
-0.169891}, {16.284, -0.157691}, {16.317, -0.150291}, {16.35, 
-0.143791}, {16.384, -0.141791}, {16.417, -0.140791}, {16.451, 
-0.138491}, {16.484, -0.130191}, {16.517, -0.118191}, {16.551, 
-0.110491}, {16.584, -0.103891}, {16.618, -0.0959909}, {16.651, 
-0.0904909}, {16.684, -0.0904909}, {16.718, -0.0836909}, {16.751, 
-0.0777909}, {16.784, -0.0724909}, {16.817, -0.0674909}, {16.851, 
-0.0596909}, {16.884, -0.0515909}, {16.918, -0.0463909}, {16.951, 
-0.0331909}, {16.984, -0.0270909}, {17.018, -0.0224909}, {17.051, 
-0.0218909}, {17.084, -0.0183909}, {17.118, -0.0119909}, {17.151, 
-0.00359086}, {17.185, 0.00700914}, {17.218, 0.00790914}, {17.251, 
  0.0137091}, {17.285, 0.0175091}, {17.318, 0.0217091}, {17.351, 
  0.0281091}, {17.385, 0.0313091}, {17.418, 0.0370091}, {17.451, 
  0.0384091}, {17.485, 0.0384091}, {17.518, 0.0418091}, {17.552, 
  0.0398091}, {17.585, 0.0384091}, {17.618, 0.0480091}, {17.652, 
  0.0538091}, {17.685, 0.0548091}, {17.718, 0.0468091}, {17.752, 
  0.0407091}, {17.785, 0.0371091}, {17.818, 0.0346091}, {17.852, 
  0.0235091}, {17.885, 0.0168091}, {17.919, 0.0129091}, {17.952, 
  0.00860914}, {17.986, 
  0.00490914}, {18.019, -0.00749086}, {18.052, -0.0237909}, {18.087,
-0.0261909}, {18.119, -0.0401909}, {18.152, -0.0499909}, {18.186, 
-0.0605909}, {18.219, -0.0764909}, {18.253, -0.0861909}, {18.286, 
-0.0924909}, {18.319, -0.101291}, {18.352, -0.117191}, {18.386, 
-0.126591}, {18.419, -0.139091}, {18.452, -0.146891}, {18.486, 
-0.161391}, {18.519, -0.174391}, {18.553, -0.182491}, {18.587, 
-0.193191}, {18.619, -0.195291}, {18.653, -0.204091}, {18.686, 
-0.216891}, {18.72, -0.227591}, {18.753, -0.237291}, {18.786, 
-0.241291}, {18.819, -0.245991}, {18.853, -0.254991}, {18.886, 
-0.270091}, {18.92, -0.278391}, {18.953, -0.279591}, {18.986, 
-0.284991}, {19.02, -0.292191}, {19.053, -0.294091}, {19.086, 
-0.291091}, {19.12, -0.287191}, {19.153, -0.281091}, {19.186, 
-0.277591}, {19.22, -0.270791}, {19.254, -0.261891}, {19.287, 
-0.249191}, {19.32, -0.242891}, {19.353, -0.241091}, {19.387, 
-0.235791}, {19.42, -0.229191}, {19.453, -0.222491}, {19.487, 
-0.217291}, {19.52, -0.209791}, {19.554, -0.203391}, {19.588, 
-0.197691}, {19.62, -0.187791}, {19.654, -0.178791}, {19.687,
-0.172691}, {19.72, -0.159691}, {19.754, -0.148191}, {19.787, 
-0.138191}, {19.821, -0.127691}, {19.854, -0.117891}, {19.887, 
-0.105391}, {19.921, -0.0924909}, {19.954, -0.0861909}, {19.988, 
-0.0772909}, {20.021, -0.0648909}, {20.054, -0.0556909}, {20.087, 
-0.0488909}, {20.121, -0.0394909}, {20.154, -0.0287909}, {20.188, 
-0.0213909}, {20.221, -0.0153909}, {20.254, -0.0106909}, {20.288, 
-0.00649086}, {20.322, 0.0114091}, {20.354, 0.0145091}, {20.388, 
  0.0144091}, {20.421, 0.0176091}, {20.455, 0.0183091}, {20.488, 
  0.0201091}, {20.521, 0.0279091}, {20.555, 0.0352091}, {20.588, 
  0.0421091}, {20.621, 0.0456091}, {20.655, 0.0477091}, {20.688, 
  0.0557091}, {20.722, 0.0580091}, {20.755, 0.0602091}, {20.788, 
  0.0637091}, {20.822, 0.0637091}, {20.855, 0.0691091}, {20.888, 
  0.0686091}, {20.922, 0.0674091}, {20.955, 0.0656091}, {20.989, 
  0.0704091}, {21.022, 0.0710091}, {21.056, 0.0712091}, {21.088, 
  0.0693091}, {21.122, 0.0697091}, {21.155, 0.0712091}, {21.188, 
  0.0705091}, {21.222, 0.0705091}, {21.255, 0.0696091}, {21.289, 
  0.0705091}, {21.322, 0.0691091}, {21.355, 0.0724091}, {21.389, 
  0.0724091}, {21.422, 0.0711091}, {21.455, 0.0707091}, {21.489, 
  0.0705091}, {21.522, 0.0694091}, {21.556, 0.0657091}, {21.589, 
  0.0632091}, {21.622, 0.0539091}, {21.656, 0.0461091}, {21.689, 
  0.0448091}, {21.722, 0.0351091}, {21.756, 0.0250091}, {21.789, 
  0.0183091}, {21.823, 0.00920914}, {21.856, 
  0.00010914}, {21.89, -0.0142909}, {21.923, -0.0217909}, {21.956,
-0.0273909}, {21.989, -0.0379909}, {22.023, -0.0471909}, {22.056, 
-0.0487909}, {22.089, -0.0635909}, {22.123, -0.0775909}, {22.157, 
-0.0885909}, {22.189, -0.0981909}, {22.223, -0.106291}, {22.256,
-0.121391}, {22.29, -0.135991}, {22.323, -0.145691}, {22.357, 
-0.155891}, {22.39, -0.168691}, {22.424, -0.187791}, {22.456, 
-0.201491}, {22.49, -0.213791}, {22.523, -0.230891}, {22.557, 
-0.235091}, {22.59, -0.241291}, {22.623, -0.250991}, {22.657, 
-0.265291}, {22.69, -0.279791}, {22.723, -0.284491}, {22.757, 
-0.296391}, {22.79, -0.317691}, {22.824, -0.321991}, {22.857, 
-0.329291}, {22.89, -0.332491}, {22.924, -0.332391}, {22.957, 
-0.330691}, {22.99, -0.328191}, {23.024, -0.314891}, {23.057, 
-0.301791}, {23.091, -0.296791}, {23.124, -0.288291}, {23.157, 
-0.280491}, {23.191, -0.270791}, {23.224, -0.259591}, {23.257, 
-0.251391}, {23.291, -0.239891}, {23.324, -0.237791}, {23.358, 
-0.233791}, {23.391, -0.222491}, {23.424, -0.211591}, {23.458, 
-0.210391}, {23.491, -0.203691}, {23.524, -0.198591}, {23.558, 
-0.195691}, {23.591, -0.191591}, {23.624, -0.186991}, {23.658, 
-0.185691}, {23.691, -0.180891}, {23.725, -0.171091}, {23.758, 
-0.167991}, {23.791, -0.166091}, {23.824, -0.162691}, {23.858, 
-0.149191}, {23.891, -0.145791}, {23.925, -0.134991}, {23.958, 
-0.122291}, {23.991, -0.115091}, {24.025, -0.106691}, {24.058, 
-0.102491}, {24.092, -0.0934909}, {24.125, -0.0914909}, {24.158, 
-0.0871909}, {24.192, -0.0756909}, {24.225, -0.0709909}, {24.258, 
-0.0594909}, {24.292, -0.0575909}, {24.325, -0.0567909}, {24.359, 
-0.0535909}, {24.392, -0.0495909}, {24.425, -0.0410909}, {24.459, 
-0.0401909}, {24.492, -0.0363909}, {24.525, -0.0332909}, {24.559, 
-0.0315909}, {24.592, -0.0267909}, {24.626, -0.0248909}, {24.659, 
-0.0169909}, {24.692, -0.0114909}, {24.725, -0.00659086}, {24.759, 
-0.00119086}, {24.792, 0.00590914}, {24.826, 0.0110091}, {24.859, 
  0.0117091}, {24.893, 0.0118091}, {24.926, 0.0142091}, {24.959, 
  0.0103091}, {24.993, 
  0.00530914}, {25.026, -0.00219086}, {25.059, -0.00399086}, {25.092, 
  0.00250914}, {25.126, 0.0104091}, {25.16, 0.00570914}, {25.193, 
  0.00620914}, {25.226, 0.00510914}, {25.259, 0.00370914}, {25.293, 
  0.00580914}, {25.326, 0.00760914}, {25.36, 0.0110091}, {25.393, 
  0.0129091}, {25.426, 0.0126091}, {25.459, 0.0139091}, {25.493, 
  0.0148091}, {25.526, 0.0178091}, {25.56, 0.0205091}, {25.593, 
  0.0200091}, {25.626, 0.0205091}, {25.66, 0.0209091}, {25.693, 
  0.0179091}, {25.727, 0.0129091}, {25.76, 0.00490914}, {25.793, 
  0.00280914}, {25.827, -0.00349086}, {25.86, -0.0106909}, {25.893,
-0.0205909}, {25.927, -0.0304909}, {25.96, -0.0372909}, {25.993, 
-0.0457909}, {26.027, -0.0514909}, {26.06, -0.0641909}, {26.094, 
-0.0774909}, {26.127, -0.0875909}, {26.16, -0.0986909}, {26.194, 
-0.111591}, {26.227, -0.125291}, {26.26, -0.136691}, {26.294,-0.146391}, {26.327, -0.160691}, {26.361, -0.177291}, {26.394, 
-0.193791}, {26.427, -0.207691}, {26.461, -0.221691}, {26.494, 
-0.231391}, {26.527, -0.243591}, {26.561, -0.261691}, {26.595, 
-0.280291}, {26.627, -0.287191}, {26.661, -0.300991}, {26.694, 
-0.317491}, {26.728, -0.325491}, {26.761, -0.330891}, {26.794,
-0.342691}, {26.828, -0.349091}, {26.861, -0.358891}, {26.894, 
-0.373891}, {26.928, -0.379791}, {26.961, -0.382891}, {26.994, 
-0.385391}, {27.028, -0.386191}, {27.061, -0.381991}, {27.095, 
-0.377691}, {27.128, -0.368991}, {27.161, -0.358691}, {27.195, 
-0.345991}, {27.228, -0.341191}, {27.261, -0.337791}, {27.295, 
-0.328791}, {27.328, -0.323091}, {27.362, -0.310791}, {27.395, 
-0.301091}, {27.428, -0.290891}, {27.462, -0.282591}, {27.495, 
-0.275791}, {27.529, -0.258291}, {27.562, -0.252991}, {27.595, 
-0.244791}, {27.629, -0.238991}, {27.662, -0.234291}, {27.695, 
-0.228291}, {27.729, -0.219491}, {27.762, -0.216991}, {27.795, 
-0.211691}, {27.829, -0.205591}, {27.862, -0.202391}, {27.895, 
-0.202991}, {27.929, -0.203891}, {27.962, -0.204391}, {27.996, 
-0.203891}, {28.029, -0.198791}, {28.062, -0.193691}, {28.096, 
-0.191491}, {28.129, -0.191991}, {28.162, -0.194391}, {28.196, 
-0.201891}, {28.229, -0.219591}, {28.262, -0.240891}, {28.296, 
-0.265491}, {28.329, -0.270991}, {28.363, -0.245291}, {28.396, 
-0.234191}, {28.429, -0.230191}, {28.463, -0.230591}, {28.496, 
-0.210591}, {28.529, -0.189991}, {28.563, -0.188491}, {28.596,
-0.181291}, {28.63, -0.156991}, {28.663, -0.146191}, {28.696, 
-0.146091}, {28.73, -0.148191}, {28.763, -0.144691}, {28.796, 
-0.137391}, {28.83, -0.130191}, {28.863, -0.122891}, {28.896, 
-0.111391}, {28.93, -0.107091}, {28.963, -0.0970909}, {28.997, 
-0.0891909}, {29.03, -0.0774909}, {29.063, -0.0731909}, {29.097, 
-0.0659909}, {29.13, -0.0527909}, {29.164, -0.0428909}, {29.197, 
-0.0354909}, {29.23, -0.0246909}, {29.263, -0.0196909}, {29.297, 
-0.0161909}, {29.33, -0.0139909}, {29.364, -0.0113909}, {29.397, 
-0.00589086}, {29.43, -0.00259086}, {29.464, -0.00219086}, {29.497, 
-0.00219086}, {29.53, -0.00199086}, {29.564, -0.00269086}, {29.597, 
-0.00989086}, {29.63, -0.0256909}, {29.664, -0.0306909}, {29.697, 
-0.0460909}, {29.73, -0.0574909}, {29.764, -0.0722909}, {29.797, 
-0.0874909}, {29.831, -0.102591}, {29.864, -0.117291}, {29.898, 
-0.134191}, {29.931, -0.148991}, {29.964, -0.165391}, {29.998, 
-0.187091}, {30.031, -0.197291}, {30.064, -0.206891}, {30.098, 
-0.219791}, {30.131, -0.230491}, {30.164, -0.233891}, {30.198, 
-0.239491}, {30.231, -0.249491}, {30.265, -0.260891}, {30.298, 
-0.279191}, {30.331, -0.284591}, {30.365, -0.292591}, {30.398, 
-0.297491}, {30.431, -0.307391}, {30.465, -0.317591}, {30.498, 
-0.321491}, {30.531, -0.322391}, {30.565, -0.316891}, {30.598, 
-0.318591}, {30.632, -0.322391}, {30.665, -0.328791}, {30.698, 
-0.332291}, {30.732, -0.334091}, {30.765, -0.334091}, {30.798, 
-0.334091}, {30.832, -0.337691}, {30.865, -0.338491}, {30.899, 
-0.338491}, {30.932, -0.337591}, {30.965, -0.341491}, {30.999, 
-0.343491}, {31.032, -0.346791}, {31.065, -0.353091}, {31.099, 
-0.354991}, {31.132, -0.353991}, {31.166, -0.355691}, {31.199, 
-0.351291}, {31.232, -0.340791}, {31.266, -0.334091}, {31.299, 
-0.330791}, {31.332, -0.326091}, {31.366, -0.309391}, {31.399, 
-0.295391}, {31.432, -0.285991}, {31.466, -0.275391}, {31.499, 
-0.265091}, {31.533, -0.256591}, {31.566, -0.242991}, {31.599, 
-0.230091}, {31.633, -0.219391}, {31.666, -0.203691}, {31.699, 
-0.189291}, {31.733, -0.183891}, {31.767, -0.169391}, {31.799, 
-0.167091}, {31.833, -0.157091}, {31.866, -0.150791}, {31.9, 
-0.137991}, {31.933, -0.123091}, {31.966, -0.114891}, {32., 
-0.108691}, {32.033, -0.0979909}, {32.066, -0.0907909}, {32.1, 
-0.0796909}, {32.133, -0.0709909}, {32.166, -0.0611909}, {32.2, 
-0.0513909}, {32.233, -0.0411909}, {32.267, -0.0323909}, {32.3, 
-0.0251909}, {32.333, -0.0188909}, {32.367, -0.0125909}, {32.4, 
-0.00609086}, {32.433, 0.00120914}, {32.467, 0.0100091}, {32.5, 
  0.0127091}, {32.533, 0.0126091}, {32.567, 0.0154091}, {32.601, 
  0.0235091}, {32.633, 0.0270091}, {32.667, 0.0255091}, {32.7, 
  0.0262091}, {32.734, 0.0262091}, {32.767, 0.0262091}, {32.8, 
  0.0257091}, {32.834, 0.0237091}, {32.867, 0.0241091}, {32.901, 
  0.0252091}, {32.934, 0.0262091}, {32.967, 0.0286091}, {33.001, 
  0.0328091}, {33.034, 0.0380091}, {33.067, 0.0442091}, {33.101, 
  0.0433091}, {33.134, 0.0389091}, {33.168, 0.0373091}, {33.201, 
  0.0316091}, {33.234, 0.0274091}, {33.268, 0.0295091}, {33.301, 
  0.0342091}, {33.334, 0.0312091}, {33.368, 0.0305091}, {33.401, 
  0.0299091}, {33.434, 0.0295091}, {33.468, 0.0346091}, {33.501, 
  0.0386091}, {33.535, 0.0375091}, {33.568, 0.0380091}, {33.601, 
  0.0443091}, {33.635, 0.0462091}, {33.668, 0.0469091}, {33.701, 
  0.0482091}, {33.735, 0.0500091}, {33.768, 0.0536091}, {33.801, 
  0.0540091}, {33.835, 0.0520091}, {33.868, 0.0532091}, {33.901, 
  0.0489091}, {33.935, 0.0472091}, {33.968, 0.0521091}, {34.002, 
  0.0484091}, {34.035, 0.0465091}, {34.068, 0.0456091}, {34.102, 
  0.0414091}, {34.135, 0.0386091}, {34.169, 0.0347091}, {34.202, 
  0.0271091}, {34.235, 0.0255091}, {34.269, 0.0161091}, {34.302, 
  0.0125091}, {34.338, 
  0.00480914}, {34.369, -0.00539086}, {34.402, -0.0129909}, {34.435, 
-0.0208909}, {34.469, -0.0297909}, {34.502, -0.0326909}, {34.536, 
-0.0474909}, {34.569, -0.0595909}, {34.602, -0.0718909}, {34.636, 
-0.0764909}, {34.669, -0.0861909}, {34.703, -0.0960909}, {34.736, 
-0.107591}, {34.769, -0.117691}}

This is the graph of whole data. enter image description here

share|improve this question
2  
Can you provide all the data? –  Mark McClure Jul 16 at 17:16

3 Answers 3

I've done this from first principles:

some random data:

 data = Table[{x + RandomReal[{-.05, .05}] + 4, 
       Sin[x] + Sin[x/3] + RandomReal[{-.3, .3}]}, {x, 0, 12 Pi , .1}]; 

treat the discrete data as a function and and use trapezoidal integration:

 trule = Mean /@ 
          Partition[
              Differences@
               {data[[1, 1]], Sequence @@ data[[;; , 1]], data[[-1, 1]]}, 2, 1];

len = Subtract @@ data[[{-1, 1}]][[;; , 1]]

the fourier sine coefficients:

 ck = 2 / len Table[ 
         trule.(#[[2]] Sin[k (#[[1]] - data[[1, 1]]) Pi/len ] & /@ data ) ,
             {k, 1, 20} ];

 Show[{ListPlot[data],   Plot[ Total@
      MapIndexed[# Sin[First@#2  Pi (t - data[[1, 1]]) / len ] & , ck ] ,
         {t, data[[1, 1]], data[[-1, 1]]}]}]

enter image description here

Now I expect someone will show a built-in way to get this...

Using the example data, with 30 terms:

enter image description here

share|improve this answer
    
I have to use 40 terms with your code to reproduce the last graph. Is that a typo? –  Jason B Jul 16 at 19:47
    
could be a mistake.. you can play with different numbers to see how well it converges. –  george2079 Jul 16 at 21:42

I took george2079's statement "Now I expect someone will show a built-in way to get this..." as a challenge, so I did the same thing using FindFit. Also, writing it this way seems more clear to me what the actual function being fitted is (but obviously relying on the internal FindFit function)

len = (Max[#] - Min[#]) &@data[[All, 1]];
func = Sum[Subscript[a, n] Sin[( \[Pi] n)/len t], {n, 1, 40}];
params = Table[Subscript[a, n], {n, 1, 40}];
soln = FindFit[data, func, params, t];
function = Compile[{{t, _Real}},
   Evaluate[func /. soln]];
Show[ListPlot[data],Plot[function[t], {t, 0, len}, PlotStyle -> {{Thick, Red}}]]

enter image description here

share|improve this answer

Fit is a function that finds the linear combination of some given terms that best fits the data. This can also be used since sine Fourier series are linear combinations of Sin.

len = Subtract @@ data[[{-1, 1}, 1]];
func =
 Fit[
  data,
  Table[ Sin[(π n)/len x], {n, 1, 40}],
  x
  ]
Show[
 ListPlot[data],
 Plot[func, {x, 0, len}, PlotStyle -> {{Thick, Red}}]
 ]

result

share|improve this answer

Your Answer

 
discard

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.