Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
3  
Have you tried ListPlot3D? –  m_goldberg Jun 18 '13 at 5:57
    
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] –  Kuba Jun 18 '13 at 6:07
    
You might want to look into thin plate splines... –  J. M. Jun 18 '13 at 6:18
    
@m_goldberg ListPlot3D seems to do what I'd like, so thanks! But do you know what interpolation method is being used? –  InsM Jun 18 '13 at 6:29
add comment

2 Answers

up vote 1 down vote accepted

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

share|improve this answer
    
Setting InterpolationOrder greater than 1 doesn't seem to make a difference unless you have regular data (sampled on a grid)... –  Rahul Narain Jun 18 '13 at 7:37
add comment

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

share|improve this answer
    
Thanks, but I'm specifically looking for a surface! –  InsM Jun 18 '13 at 6:33
    
so why not pasting your data completely? –  Stefan Jun 18 '13 at 6:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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