I have a set of data which was obtained from numerical calculation. The plot of the original data is as follows (the data is 26Kb only).
data = ToExpression /@ Import["~\\testdata.csv"];
ListPlot[data, PlotRange -> All]
The data consist of interlaced points as can be seen in the enlarged view
ListLinePlot[data, Mesh -> All, MeshStyle -> Red, PlotRange -> {{1.88, 2.2}, {0.39, 0.42}}]
I hope to plot smooth curves to approximate these points and have tried FindCurvePath
curvetest = FindCurvePath[data];
Curvetest = ListLinePlot[{data[[curvetest[[1]]]], data[[curvetest[[2]]]]}, Frame -> True, Axes -> False, PlotRange -> All]
It gives two smooth curves, but near the left and right interactions, some parts are lost in comparison with the original plot. I guess this could result from the points jumping up and down near the intersections and FindCurvePath
cannot distinguish the rapid jump there.
I have an idea to deal with this: (1) separate the data for the upper and lower curves, and (2) use FindCurvePath
or some other method (e.g. Fit
) to plot two smooth and complete curves. But I have trouble in the first step. Can anyone help with this? Thank you!
data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
then you can usedata[[;; 5]]
to pick the first five ones for example. Similarly,data[[5 ;;]]
gives the last five entries of the original list. So, maybe you can use that to separate data and do your fits. $\endgroup$