2
$\begingroup$

I have a set of $(x,y,z)$ coordinates which sparsely cover a surface, e.g.:

data = {{51, 15, 0.1}, {300, 11, 0.99}, {140, 22, 0.123}, {54, 12, 0.66}, ...};

What is a good general method, in Mathematica 9, of interpolating and plotting a surface for this sparse data set? Graphics3D[BSplineSurface[data]] doesn't seem to get the job done; the output is a planar rectangle.

$\endgroup$
  • 3
    $\begingroup$ Have you tried ListPlot3D? $\endgroup$ – m_goldberg Jun 18 '13 at 5:57
  • $\begingroup$ Interpolation works for multidimensional functions but You have to be sure that there are no duplicates in {x,y} with different z. Interpolation[{{#1, #2}, #3} & @@@ data] $\endgroup$ – Kuba Jun 18 '13 at 6:07
  • $\begingroup$ You might want to look into thin plate splines... $\endgroup$ – J. M. is away Jun 18 '13 at 6:18
  • $\begingroup$ @m_goldberg ListPlot3D seems to do what I'd like, so thanks! But do you know what interpolation method is being used? $\endgroup$ – InsM Jun 18 '13 at 6:29
1
$\begingroup$

You can use the option InterpolationOrder to control the degree of smoothing.

SeedRandom[42]; data = RandomReal[10, {20, 3}];
Column[
 ListPlot3D[data,
    ImageSize -> Medium,
    Mesh -> None,
    InterpolationOrder -> #] & /@ Range[0, 2]]

enter image description here

$\endgroup$
  • $\begingroup$ Setting InterpolationOrder greater than 1 doesn't seem to make a difference unless you have regular data (sampled on a grid)... $\endgroup$ – Rahul Jun 18 '13 at 7:37
1
$\begingroup$

I'd go with ListPointPlot3D.

ListPoint3D generates a 3D scattered plot of points with coordinates {xi,yi,zi}.

Since you're a bit avaricious with your data, here the plot with your data:

data = {{51, 15, 0.1}, {300, 11, 0.99}, {140, 22, 0.123}, {54, 12, 0.66}};
ListPointPlot3D[data, PlotStyle -> PointSize[0.03], Filling -> Bottom,
   ViewPoint -> {0, 0, \[Infinity]}]

enter image description here

Edit:

If you want to use BSpline, just take a BSplineCurve, if your data does not produce a decent surface:

Graphics3D[{BSplineCurve[data], PointSize[Medium], Green, Line[data], 
    Red, Point[data]}, BoxRatios -> {2, 2, 2}]

enter image description here

Edit2:

For a BSplineSurface (with qualified data) you can do something like:

data=Table[{i, j, RandomReal[{-1, 1}]}, {i, 3}, {j, 3}];
Show[Graphics3D[{PointSize[Medium], Red, Map[Point, data], Gray, 
    Line[data], Line[Transpose[data]]}], Graphics3D[BSplineSurface[data]]]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks, but I'm specifically looking for a surface! $\endgroup$ – InsM Jun 18 '13 at 6:33
  • $\begingroup$ so why not pasting your data completely? $\endgroup$ – Stefan Jun 18 '13 at 6:49

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.