2
$\begingroup$

I am trying to get Mathematica to interpolate a list of points so that I can find precise x values x(f) that won't have a corresponding data point. Here's what I've tried:

 data={{19.668, 0.161158}, {18.5235, 0.17188}, {17.581, 0.183499}, {16.7985,
   0.196057}, {16.1445, 0.209601}, {15.595, 0.224179}, {15.1315, 
  0.239842}, {14.7395, 0.256644}, {14.4075, 0.274639}, {14.1265, 
  0.293882}, {13.8885, 0.314433}, {13.6875, 0.336349}, {13.518, 
  0.359688}, {13.3765, 0.384507}, {13.2585, 0.410862}, {13.162, 
  0.43881}, {13.083, 0.468401}, {13.0205, 0.499684}, {12.9715, 
  0.532704}, {12.935, 0.567499}, {12.909, 0.604103}, {12.892, 
  0.642541}, {12.8835, 0.682831}, {12.8815, 0.724979}, {12.885, 
  0.768983}, {12.8935, 0.814829}, {12.906, 0.862489}, {12.9215, 
  0.911922}, {12.9395, 0.963073}, {12.9595, 1.01587}, {12.98, 
  1.07023}, {13.001, 1.12604}, {13.022, 1.1832}, {13.0425, 
  1.24156}, {13.0615, 1.30096}, {13.0785, 1.36126}, {13.094, 
  1.42226}, {13.1065, 1.48377}, {13.1165, 1.54559}, {13.1235, 
  1.6075}, {13.1265, 1.66927}, {13.126, 1.73069}, {13.122, 
  1.79152}, {13.1135, 1.85153}, {13.1005, 1.91048}, {13.0835, 
  1.96817}, {13.062, 2.02436}, {13.0355, 2.07887}, {13.005, 
  2.13148}, {12.97, 2.18203}, {12.9305, 2.23035}, {12.8865, 
  2.27629}, {12.838, 2.31974}, {12.786, 2.36058}, {12.7295, 
  2.39873}, {12.6695, 2.43413}, {12.606, 2.46673}, {12.539, 
  2.49651}, {12.469, 2.52347}, {12.396, 2.54761}, {12.32, 
  2.56897}, {12.242, 2.58759}, {12.1615, 2.60354}, {12.079, 
  2.61689}, {11.995, 2.62772}, {11.9095, 2.63613}, {11.823, 
  2.64222}, {11.7355, 2.64609}, {11.647, 2.64786}, {11.558, 
  2.64765}, {11.469, 2.64558}, {11.38, 2.64177}, {11.291, 
  2.63633}, {11.2025, 2.6294}, {11.1145, 2.62109}, {11.0275, 
  2.61152}, {10.9415, 2.6008}, {10.8565, 2.58906}, {10.7725, 
  2.57639}, {10.69, 2.5629}, {10.609, 2.5487}, {10.53, 
  2.53389}, {10.453, 2.51855}, {10.3775, 2.50278}, {10.304, 
  2.48667}, {10.233, 2.47028}, {10.164, 2.45371}};

Show[ListPlotdata], Plot[Interpolation[data,][x], {x, 10.2, 16}]], InterpolationOrder -> 2

And it gives me the following plot:

Interpolated function

Which obviously doesn't look very good in the middle where the function becomes very steep! Unfortunately, this is right where I need to find x values, where f is between .8 and 1.8. I have also tried other InterpolationOrders and InterpolationMethods, but they all look just as bad.

Is there anyway to get a better fit? Or any other method for finding values of f? I tried using FindClosest but that wasn't precise enough for my means.

Thanks in advance!

$\endgroup$
  • 1
    $\begingroup$ The problem is that your function "f" is not a one-variable function, as for one value of x you may have more than one value of f(x) This may be of your interest: mathematica.stackexchange.com/questions/47332/… $\endgroup$ – Fraccalo Jun 6 '18 at 16:06
  • $\begingroup$ Do you have some way to decide which of the two possible y values you want when x is near the middle? $\endgroup$ – Rudy Potter Jun 6 '18 at 16:15
  • $\begingroup$ This could be a duplicate of this post. $\endgroup$ – march Jun 6 '18 at 16:20
6
$\begingroup$

Here's how I would do it. Interpolate both x and y data separately, and then use ParametricPlot:

Show[
 ListPlot[data],
 ParametricPlot[{Interpolation[data[[All, 1]]][x], Interpolation[data[[All, 2]]][x]},
  Evaluate@{x, Sequence @@ First@Interpolation[data[[All, 1]]]["Domain"]}, 
  PlotStyle -> Black
 ]
]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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