Wolfram mathematica 在Mathematica中,ListPlot使用的插值函数是什么?

Wolfram mathematica 在Mathematica中,ListPlot使用的插值函数是什么?,wolfram-mathematica,interpolation,Wolfram Mathematica,Interpolation,[以下截图] 我用ListPlot在一些数据点上画了一条平滑的线。但我希望能够处理绘图的一阶和二阶导数,所以我想我应该使用插值创建一个实际的“函数”。但正如你在图片中看到的,它并不平滑。当我绘制[插值[…]时,会出现一些奇怪的尖峰。我想知道ListPlot是如何得到插值函数的,以及如何使用插值[]或其他方法得到同样的结果 谢谢, 抢劫 以下是一些用于复制/粘贴的文本: myPoints = {{0.,3.87},{1.21,4.05},{2.6,4.25},{4.62,4.48},{7.24,4

[以下截图]

我用ListPlot在一些数据点上画了一条平滑的线。但我希望能够处理绘图的一阶和二阶导数,所以我想我应该使用插值创建一个实际的“函数”。但正如你在图片中看到的,它并不平滑。当我绘制[插值[…]时,会出现一些奇怪的尖峰。我想知道ListPlot是如何得到插值函数的,以及如何使用插值[]或其他方法得到同样的结果

谢谢,
抢劫

以下是一些用于复制/粘贴的文本:

myPoints = {{0.,3.87},{1.21,4.05},{2.6,4.25},{4.62,4.48},{7.24,4.73},{9.66,4.93},
{12.48,5.14},{14.87,5.33},{17.34,5.55},{19.31,5.78},{20.78,6.01},{22.08,6.34},
{22.82,6.7},{23.2,7.06},{23.41,7.54},{23.52,8.78},{23.59,9.59},{23.62,9.93},
{23.72,10.24},{23.88,10.56},{24.14,10.85},{24.46,11.05},{24.81,11.2},
{25.73,11.44},{27.15,11.63}}

ListPlot[myPoints, Joined -> True, Mesh -> Full] 

Plot[Interpolation[myPoints][x], {x, 0, 27.2}] 
最后一个有尖刺

编辑…

Gleno pointed out that my List plot is linear.  But what about when both have 
InterpolationOrder -> 3?
ListPlot[myPoints, Joined -> True, Mesh -> Full, InterpolationOrder -> 3]
Plot[Interpolation[myPoints, InterpolationOrder -> 3][x], {x, 0, 27.2}]

很抱歉让你失望,但答案很简单
ListLinePlot
/
ListPlot
只是画了一条直线

Plot[Interpolation[myPoints, InterpolationOrder -> 1][x], {x, 0, 27.2}]

产生相同的非黑客线路。应用二阶插值和使用样条曲线可能会有不同的成功程度

Plot[Interpolation[myPoints, InterpolationOrder -> 2, Method -> "Spline"][x], {x, 0, 27.2}]

我认为,
ListPlot
用于插值的方法是将每个坐标作为列表索引的函数进行插值。类似于以下内容的内容与
ListPlot[…,InterpolationOrder->3]
的输出非常相似:

With[{
  xyInterpolation=Interpolation[#,InterpolationOrder->3]&/@Transpose[myPoints]},
  ParametricPlot[Through[xyInterpolation[i]],{i,1,Length[myPoints]}]
]
从这样的插值中,你应该能够通过隐式微分获得导数,例如dx/dy==(dx/dt)/(dy/dt)。在一个可能会让数学家呕吐的地方炫耀这种符号是一种乐趣:)

也许更容易:

interp = Interpolation[myPoints, InterpolationOrder -> 2, Method -> "Spline"]

(*Now let's plot the function and its derivative*)
Show[ListPlot@myPoints, 
     Plot[{interp'[x], interp[x]}, 
          {x, Min[First /@ myPoints], Max[First /@ myPoints]}, PlotRange -> All]]

在“利益区域”:

如果需要连续的二阶导数,只需按如下方式增加插值阶数:

interp = Interpolation[myPoints, InterpolationOrder -> 3, Method -> "Spline"];
Show[Plot[{interp'[x], interp[x]}, {x, 23, 24}], ListPlot@myPoints]

啊,我没有注意到那些实际上是直的。但是,当您将interpolationOrder->3添加到这两个函数时,会发生什么呢?(我试着给这个评论添加一些代码…坏主意…让我来编辑这个问题。)好的,使用InterpolationOrder->3,我在ListPlot上得到了一条平滑的曲线,带有圆角的线段,但是一条粗糙的曲线[Interpolation[…谢谢,这正是我想要的。
interp = Interpolation[myPoints, InterpolationOrder -> 3, Method -> "Spline"];
Show[Plot[{interp'[x], interp[x]}, {x, 23, 24}], ListPlot@myPoints]