Skip to main content
1 of 2
Sjoerd C. de Vries
  • 66.4k
  • 15
  • 192
  • 337

You are talking about a list of 3D points and curve fitting. I therefore assume you want a function with a single parameter that describes a curve fitting through your set of points. I don't believe ListInterpolate can handle that.

My alternative is the following.

First, a set of 3D points:

pts1 = Table[{Sin[t], Cos[t], Cos[t] Sin[t]}, {t, 0, 2 \[Pi], \[Pi]/5}] // N; 

I get incomprehensible errors (Interpolation::mspl: The Spline method could not be used because the data could not be coerced to machine real numbers) if I interpolate using the "Spline" method combined with PeriodicInterpolation . I therefore add the 2nd and 3rd point to the end of the array (the last and first one were already the same). This ensures a smooth connection of beginning and end of the list:

pts2 = Join[pts1, pts1[[2 ;; 3]]]; 

I now interpolate through each dimension separately:

f = Interpolation[#, InterpolationOrder->3, Method->"Spline"] & /@Transpose[pts1] 

Plot the result:

ParametricPlot3D[Through[f[x]], {x, 1, Length[pts1]}] 

Mathematica graphics

Sjoerd C. de Vries
  • 66.4k
  • 15
  • 192
  • 337