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 some 3D point data and I want to create a curved surface with these points, and export the curved surface data (point coordinates) according to points density on the curved surface. How can I do that?

The data is in 3 columns. I use ListPlotPoint3D[] to show the spatial distribution of these points.

w1 = Import["FaultMode_szk_test.txt", "Table"];

104.0152    31.3715 -1.8614
103.9882    31.3934 -4.7228
103.9611    31.4154 -6.5841
103.9341    31.4373 -8.4455
103.9070    31.4592 -9.3069 
103.9591    31.3203 -1.8614 
103.9318    31.3420 -4.7228
103.9045    31.3637 -6.5841
103.8772    31.3854 -8.4455 
103.8498    31.4071 -9.3069 
103.9035    31.2694 -1.8614 
103.8762    31.2910 -4.7228 
103.8490    31.3127 -6.5841 
103.8217    31.3344 -8.4455 
103.7944    31.3561 -9.3069 
103.8480    31.2184 -1.8614 
103.8207    31.2401 -4.7228 
103.7932    31.2616 -6.9841 
103.7735    31.2925 -8.6455 
103.7475    31.3150 -9.3069 
103.8003    31.1799 -1.8614 
103.7825    31.2073 -3.7228 
103.7662    31.2350 -5.5841 
103.7285    31.2631 -7.4455    
103.7079    31.2891 -9.3069

ListPointPlot3D[w1]
share|improve this question
add comment

2 Answers

Use ListPlot3D.

data = {{104.0152`, 31.3715`, -1.8614`}, {103.9882`, 
    31.3934`, -4.7228`}, {103.9611`, 31.4154`, -6.5841`}, {103.9341`, 
    31.4373`, -8.4455`}, {103.907`, 31.4592`, -9.3069`}, {103.9591`, 
    31.3203`, -1.8614`}, {103.9318`, 31.342`, -4.7228`}, {103.9045`, 
    31.3637`, -6.5841`}, {103.8772`, 31.3854`, -8.4455`}, {103.8498`, 
    31.4071`, -9.3069`}, {103.9035`, 31.2694`, -1.8614`}, {103.8762`, 
    31.291`, -4.7228`}, {103.849`, 31.3127`, -6.5841`}, {103.8217`, 
    31.3344`, -8.4455`}, {103.7944`, 31.3561`, -9.3069`}, {103.848`, 
    31.2184`, -1.8614`}, {103.8207`, 31.2401`, -4.7228`}, {103.7932`, 
    31.2616`, -6.9841`}, {103.7735`, 31.2925`, -8.6455`}, {103.7475`, 
    31.315`, -9.3069`}, {103.8003`, 31.1799`, -1.8614`}, {103.7825`, 
    31.2073`, -3.7228`}, {103.7662`, 31.235`, -5.5841`}, {103.7285`, 
    31.2631`, -7.4455`}, {103.7079`, 31.2891`, -9.3069`}};

ListPlot3D[data]

This will only work if the surface "does not curve under itself", i.e. it could be described by a $z=f(x,y)$ function.

share|improve this answer
    
,Thanks to you ,How can I get the z=f(x,y) ? –  Wo Xin May 18 '13 at 3:58
add comment

You can get a function for your data using interpolation. First reformat Szabolcs variable data into data2' and create a functionf`

 data2 = Table[{data[[i, {1, 2}]], data[[i, 3]]}, {i, 1, Length[data]}]; 
 f = Interpolation[data2, InterpolationOrder -> 1]

You can plot the function

 {minx, maxx} = {Min[data[[All, 1]]], Max[data[[All, 1]]]};
 {miny, maxy} = {Min[data[[All, 2]]], Max[data[[All, 2]]]};
 Plot3D[f[x, y], {x, minx, maxx}, {y, miny, maxy}]

or ask for the value of the function at any point:

f[104,31.4]

and get an answer (1.68 in this case) even though the "data" does not exist at that point. Observe that Mathematica may give you a warning when you ask for values that are outside the known range of the function.

share|improve this answer
    
I get an error: Interpolation::indim: The coordinates do not lie on a structured tensor product grid. >> Version difference perhaps? Nevertheless you could write: data2 = {{#, #2}, #3} & @@@ data; and {{minx, maxx}, {miny, maxy}} = {Min@#, Max@#} & /@ Most@Transpose@data; to simplify your answer. –  Mr.Wizard May 18 '13 at 8:02
    
I think they updated Interpolation to work with unstructured grids at some point. Version 9 has this, but insists that it can only use InterpolationOrder->1 (which is why I added that optino to remove the warning). –  bill s May 18 '13 at 8:04
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.