0
$\begingroup$

I have some data that I'd like to find a periodic, continuous function that will approximately fit to:

data={{0.0936962,0.0270862},{0.115233,0.145407},{0.144849,0.262185},{0.18072,0.377282},{0.221018,0.49056},{0.257301,0.627628},{0.295673,0.757493},{0.337199,0.868766},{0.382255,0.952742},{0.43682,0.981143},{0.503706,0.936757},{0.569108,0.860408},{0.628899,0.759121},{0.678952,0.639921},{0.690301,0.522011},{0.685416,0.399376},{0.674975,0.271783},{0.663962,0.141791},{0.663175,0.014363},{0.685254,-0.104778},{0.713799,-0.221913},{0.747581,-0.337052},{0.785366,-0.450208},{0.822,-0.582662},{0.859839,-0.714971},{0.900764,-0.830273},{0.94515,-0.919859},{0.99656,-0.965099},{1.06515,-0.926806},{1.13231,-0.855449},{1.19332,-0.758203},{1.24344,-0.642242},{1.25456,-0.525299},{1.23874,-0.406979},{1.2157,-0.283425},{1.19162,-0.156898},{1.17516,-0.0303219},{1.19331,0.0885252},{1.2202,0.20588},{1.25401,0.321605},{1.2929,0.43556},{1.33099,0.563469},{1.36831,0.697935},{1.40865,0.816976},{1.45238,0.911886},{1.49987,0.973959},{1.56822,0.942449},{1.63599,0.87657},{1.69847,0.783497},{1.75092,0.670404},{1.77092,0.551412},{1.7555,0.433008},{1.73251,0.309592},{1.70868,0.183855},{1.69069,0.0584907},{1.71575,-0.0522204},{1.75403,-0.15947},{1.79892,-0.265626},{1.847,-0.371852},{1.88809,-0.493204},{1.91582,-0.636881},{1.94382,-0.768884},{1.97407,-0.879205},{2.00856,-0.957838},{2.0674,-0.947164},{2.13315,-0.888161},{2.19701,-0.799206},{2.25431,-0.687758},{2.29135,-0.56586},{2.2916,-0.447008},{2.28357,-0.321803},{2.27225,-0.192802},{2.26262,-0.0625656},{2.27484,0.0600786},{2.30001,0.178306},{2.33109,0.294533},{2.36684,0.408769},{2.4053,0.526898},{2.44296,0.666954},{2.483,0.793954},{2.52537,0.898515},{2.57002,0.971256},{2.62383,0.964648},{2.68179,0.896665},{2.73659,0.797775},{2.78497,0.676355},{2.82119,0.54281},{2.8216,0.422406},{2.81429,0.297515},{2.80384,0.170022},{2.79479,0.0418083}};

I'd like it to continue with the same period indefinitely, with period as close to average of 2.5 periods presented here.

I have tried parametrize and then interpolating it with

parametrizeCurve[pts_ /; MatrixQ[pts, NumericQ], 
a : (_?NumericQ) : 1/2] := FoldList[Plus, 0, Normalize[(Norm /@ Differences[pts])^a, Total]]

and then trying to find a periodic fit for x and y separately (as sums of periodic curves, for example), but I am coming up short. Is there a better way to do this?

$\endgroup$
4
  • 1
    $\begingroup$ Your x values are not monotonously increasing. Is this correct? $\endgroup$ May 20, 2021 at 9:39
  • $\begingroup$ @DanielHuber yes, it is I'm afraid! $\endgroup$
    – martin
    May 20, 2021 at 9:45
  • $\begingroup$ Please can you edit your question to include that you want the fitted function to be periodic. $\endgroup$
    – flinty
    May 20, 2021 at 14:09
  • $\begingroup$ @flinty have done. thank you $\endgroup$
    – martin
    May 20, 2021 at 16:45

1 Answer 1

1
$\begingroup$

Here I present a one-dimensional interpolation ip[t] with curveparameter 0<t<1:

ti = Subdivide[0, 1, Length[data] - 1];(* curve parameter*)
ip = Interpolation[MapThread[{#1, #2} &, {ti, data}] ]
Show[{ParametricPlot[ip[t], {t, 0, 1}], ListPlot[data]}]

enter image description here

$\endgroup$

Your Answer

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

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