0
$\begingroup$

I have a question to find the surface plot on the list of data with different data length. Each of the sample a different length, how can I combine all these data and find the best fit surface for the 3D graph plot? Appreciate the advice. Thank you.

Prange = {{-0.1, 0.7}, {0, 32}, {0, 20}}

Dimensions5cmMean ={{0, 5, 10.0283}, {1/5, 5, 10.4103}, {2/5, 5, 8.66286}, {3/5, 5, 7.34104}}

G5 = ListPointPlot3D[Dimensions5cmMean, PlotRange -> Prange, 
  AxesLabel -> {"ε", "L", "KΩ/cm"}, 
  PlotStyle -> Pink]

Dimensions7cmMean ={{0, 7, 11.425}, {1/7, 7, 11.3625}, {2/7, 7, 10.4944}, {3/7, 7, 9.76909}, {4/7, 7, 9.08636}}


G7 = ListPointPlot3D[Dimensions7cmMean, PlotRange -> Prange, 
  AxesLabel -> {"ε", "L", "KΩ/cm"}, 
  PlotStyle -> Purple]

Dimensions10cmMean ={{0, 10, 12.8775}, {1/10, 10, 14.2447}, {1/5, 10, 12.9257}, {3/10, 10,11.984}, {2/5, 10, 11.2065}, {1/2, 10, 10.5361}, {3/5, 10, 9.87188}}

G10 = ListPointPlot3D[Dimensions10cmMean, PlotRange -> Prange, 
  AxesLabel -> {"ε", "L", "KΩ/cm"}, 
  PlotStyle -> Green]

Dimensions20cmMean ={{0, 20, 14.7506}, {1/20, 20, 16.2232}, {1/10, 20, 15.504}, {3/20, 20, 14.6201}, {1/5, 20, 13.9161}, {1/4, 20, 13.266}, {3/10, 20, 12.7178}, {7/20, 20, 12.2796}, {2/5, 20, 11.8446}, {9/20, 20, 11.4573}, {1/2, 20, 11.0733}, {11/20, 20, 10.7722}, {3/5, 20,10.4332}} 

G20 = ListPointPlot3D[Dimensions20cmMean, PlotRange -> Prange, 
  AxesLabel -> {"ε", "L", "KΩ/cm"}, 
  PlotStyle -> Orange]

Dimensions27cmMean ={{0, 27, 16.8722}, {1/27, 27, 18.2381}, {2/27, 27, 17.2052}, {1/9, 27,16.4461}, {4/27, 27, 15.95}, {5/27, 27, 15.4401}, {2/9, 27,15.0268}, {7/27, 27, 14.5422}, {8/27, 27, 14.19}, {1/3, 27,13.9292}, {10/27, 27, 13.5257}, {11/27, 27, 13.2465}, {4/9, 27, 12.9662}, {13/27, 27, 12.7288}, {14/27, 27, 12.5179}, {5/9, 27, 12.275}, {16/27, 27, 12.0376}}

G27 = ListPointPlot3D[Dimensions27cmMean, PlotRange -> Prange, 
  AxesLabel -> {"ε", "L", "KΩ/cm"}, 
  PlotStyle -> Blue]

Dimensions30cmMean ={{0, 30, 12.5678}, {1/30, 30, 16.6086}, {1/15, 30, 16.7578}, {1/10, 30, 16.3722}, {2/15, 30, 15.7368}, {1/6, 30, 15.0586}, {1/5, 30, 14.4477}, {7/30, 30, 13.8928}, {4/15, 30, 13.3904}, {3/10, 30, 12.9197}, {1/3, 30, 12.4946}, {11/30, 30, 12.0886}, {2/5, 30, 11.7595}, {13/30, 30, 11.4233}, {7/15, 30, 11.1133}, {1/2, 30, 10.833}, {8/15, 30, 10.6007}, {17/30, 30, 10.3411}, {3/5, 30, 10.1111}}

G30 = ListPointPlot3D[Dimensions30cmMean, PlotRange -> Prange, 
  AxesLabel -> {"ε", "L", "KΩ/cm"}, 
  PlotStyle -> Red]

Show[{G5, G7, G10, G20, G27, G30}]
$\endgroup$
  • $\begingroup$ why not ListPlot3D[ Join[Dimensions5cmMean, Dimensions7cmMean, Dimensions10cmMean, Dimensions20cmMean, Dimensions27cmMean, Dimensions30cmMean]]? $\endgroup$ – kglr Jul 16 '18 at 8:35
1
$\begingroup$

Since the number of points is very limited for some of your lists, it seems that the only reasonable solution would be to interpolate your findings with a limited InterpolationOrder parameter. by default, if the points are not arranged in a regular grid, this parameter is set to one.

Here's the code:

int = Interpolation[
  Join[Dimensions5cmMean, Dimensions7cmMean, Dimensions10cmMean, 
   Dimensions20cmMean, Dimensions27cmMean, Dimensions30cmMean]]

Show[Join[Dimensions5cmMean, Dimensions7cmMean, Dimensions10cmMean, 
   Dimensions20cmMean, Dimensions27cmMean, Dimensions30cmMean] // 
  ListPointPlot3D[#, 
    AxesLabel -> {"\[CurlyEpsilon]", "L", "K\[CapitalOmega]/cm"}, 
    PlotStyle -> Red, PlotRange -> Prange
    ] &,
 Plot3D[int[x, y], {x, 0, 0.6}, {y, 5, 30}]]

enter image description here

Now, if you had more points, it should be possible to interpolate each list and than smooth your data (but I would not feel very comfortamble with interpolating 4 points to get a meaningful result).

Edit

Here's a small function which uses interpolation on separate lists to get a regular grid of points.

prepareDataForInterpolation[data_, numberOfPoints_, 
  interpolationOrder_] := 
 Module[{len, finalData = data, interpolatedData, 
   interpolation = 
    Interpolation[#, (InterpolationOrder -> {interpolationOrder, 
         0})] &, xMin, xMax, y},
  len = Length[data];
  interpolatedData = Map[interpolation[data[[#]]] &, Range[len]];

  xMin = Max[interpolatedData[[;; , 1, 1, 1]]];
  xMax = Min[interpolatedData[[;; , 1, 1, 2]]];
  y = interpolatedData[[;; , 1, 2, 1]];

  finalData = Table[
    Table[{x, y[[i]], interpolatedData[[i]][x, y[[i]]]}, {x, xMin, 
      xMax, (xMax - xMin)/numberOfPoints}],
    {i, len}];
  Return[finalData]

]


data = {Dimensions5cmMean, Dimensions7cmMean, Dimensions10cmMean, 
Dimensions20cmMean, Dimensions27cmMean, Dimensions30cmMean};
newSet = prepareDataForInterpolation[data, 5, 2];
int = Interpolation[Join @@ newSet, InterpolationOrder -> {2, 1}];
Show[newSet // 
  ListPointPlot3D[#, 
    AxesLabel -> {"\[CurlyEpsilon]", "L", "K\[CapitalOmega]/cm"}, 
    PlotStyle -> Red, PlotRange -> Prange
    ] &,
 Plot3D[int[x, y], {x, 0, 0.6}, {y, 5, 30}]]

enter image description here

$\endgroup$
  • $\begingroup$ Should be also possible to interpolate the relation in ys (provided the data is smooth). Should be easy to do it but have to go! $\endgroup$ – Gregory Rut Jul 16 '18 at 9:15

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.