Extract points from an interpolated curve (not a function)

4 replies · 2K views · last reply
member 428835
Hi PF!

I have the given data points here
Code:
data = 
{{1.92, 0.74}, {2.32, 1.36}, {2.44, 1.88}, {2.52, 2.08}, {2.68, 
  1.92}, {2.64, 1.4}, {2.46, 0.78}};

and the following plots the correct interpolation

Code:
Show[{ListLinePlot[{data}, InterpolationOrder -> 3], 
  ListPlot[\[Lambda]cplx1]}]
Plot of a smooth curve through seven marked points on dark background, x-axis 2.0 to 2.6, y-axis 0.0 to 2.0; curve rises from left, loops over top and returns to lower right.

but I don't know how to extract points along this curve. If I try this

Code:
f = Interpolation[data];
Plot[f[x], {x, 1.92, 2.6}]
the plot is terrible:
Line plot of a smooth curve on a dark background, x-axis from about 1.9 to 2.6 and y-axis from about -10 to 5; the curve falls to a minimum near -10 at x about 2.07, rises through zero near 2.3, peaks near 5 at x about 2.37, dips to about 0.5 near 2.47, then ends near 1.5 at x about 2.6.


Any ideas how to extract several points from the correct function?
 
It looks like the data points represent a curve in a 2D space parameterized by a single unspecified parameter. So the points are {x[t],y[t]} with t unspecified.

Then your interpolation is y[x].
 
  • Like
Likes   Reactions: member 428835
Just thought this exact point! Got it working now, thanks Dale!
 
  • Like
Likes   Reactions: Dale
Dale said:
What is your new code?
My ultimate goal was to import into MATLAB. I was having difficulties with the interpolation, but realized (as you pointed out) that the plots didn't know which order to interpolate, and that including the third coordinate does so nicely. So I did not use Mathematica for plotting, but exported the points into MATLAB. Thanks so much for your help!