2
$\begingroup$

I have the following set of points in a 3D space

Tinterspike200 = {3.01026957638`, 5.314505776636686`, 
   10.494223363285943`, 16.585365853657912`};
Tinterspike400 = {2.5609756097561167`, 3.940949935815186`, 
   6.103979460847167`, 8.921694480102463`, 12.50962772785579`, 
   17.092426187419257`, 22.13093709884531`};
Tinterspike600 = {2.3748395378690628`, 3.177150192554557`, 
   4.358151476251605`, 6.059050064184852`, 8.401797175866495`, 
   11.206675224646983`, 14.80744544287548`, 18.58793324775353`, 
   22.310654685494224`, 26.78433889602054`};
Tinterspike800 = {2.2657252888318355`, 2.7856225930680356`, 
   3.4403080872913994`, 4.2105263157894735`, 5.7124518613607185`, 
   8.318356867779203`, 11.59178433889602`, 14.441591784338895`, 
   17.77920410783055`, 21.059050064184852`, 25.532734274711167`};
Tinterspike1000 = {2.1822849807445444`, 2.593068035943517`, 
   3.0680359435173297`, 3.5879332477535297`, 4.255455712451861`, 
   5.423620025673941`, 8.164313222079588`, 11.07188703465982`, 
   13.49165596919127`, 16.084724005134788`, 19.17201540436457`, 
   22.35558408215661`, 25.84724005134788`};
  
Nspikes200 = {1, 2, 3, 4};
Nspikes400 = {1, 2, 3, 4, 5, 6, 7};
Nspikes600 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
Nspikes800 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
Nspikes1000 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
Istim = {200, 400, 600, 800, 1000};

data1 = Table[{Istim[[1]], Tinterspike200[[i]], Nspikes200[[i]]}, {i,1,4}]; 
data2 = Table[{Istim[[2]], Tinterspike400[[i]], Nspikes400[[i]]}, {i,1,7}]; 
data3 = Table[{Istim[[3]], Tinterspike600[[i]], Nspikes600[[i]]}, {i,1,10}]; 
data4 = Table[{Istim[[4]], Tinterspike800[[i]], Nspikes800[[i]]}, {i,1,11}]; 
data5 = Table[{Istim[[5]], Tinterspike1000[[i]], 
Nspikes1000[[i]]}, {i, 1, 13}]; 
data = Join[data1, data2, data3, data4, data5]; 
ListPointPlot3D[data, PlotStyle -> {PointSize[Large],Red}]

Now how can I find a function which interpolates these points? Thanks for who will help me!

$\endgroup$
5
  • $\begingroup$ Modified example from the docs for Interpolation: data = Table[{t, {t Sin[\[Pi] t], t Cos[\[Pi] t], Cos[2 \[Pi] t]}}, {t, 0, 2, .2}]; fun = Interpolation[data]; ParametricPlot3D[fun[t], {t, 0, 2}] $\endgroup$
    – Michael E2
    Nov 1, 2020 at 23:02
  • $\begingroup$ Thanks for your help, but I need a 3D interpolation. I have seen examples of Interpolation and ListInterpolation, but I was not able to find such interpolating function. $\endgroup$
    – VDF
    Nov 1, 2020 at 23:09
  • 1
    $\begingroup$ What do you mean by a 3D interpolation? The domain is 3D? The range? Or the domain is 2D and the output is 1D? (Or something else?) In any case, Interpolation does all of those. $\endgroup$
    – Michael E2
    Nov 2, 2020 at 0:21
  • $\begingroup$ Unmodified example from the docs: data = Flatten[Table[{{x, y}, {x Sin[\[Pi] y], y Cos[\[Pi] x], Tan[\[Pi] x y]}}, {x, 0, 1, .2}, {y, 0, 1, .2}], 1]; fun = Interpolation[data]; Plot3D[fun[x, y], {x, 0, 1}, {y, 0, 1}] $\endgroup$
    – Michael E2
    Nov 2, 2020 at 0:24
  • 1
    $\begingroup$ Try this on your data: fun = Interpolation[data]; Plot3D[fun[x, y], {x, y} \[Element] fun["ElementMesh"]] -- i.stack.imgur.com/h4j9K.png $\endgroup$
    – Michael E2
    Nov 2, 2020 at 0:30

1 Answer 1

3
$\begingroup$
data = Join[data1, data2, data3, data4, data5];

lpp = ListPointPlot3D[data, PlotStyle -> {PointSize[Large], Red}];

{xmin, xmax} = MinMax[data[[All, 1]]];
{ymin, ymax} = MinMax[data[[All, 2]]];

dataInterp = {Most@#, Last@#} & /@ data;

f = Interpolation[dataInterp, InterpolationOrder -> 1];

Show[
 Plot3D[f[x, y], {x, xmin, xmax}, {y, ymin, ymax}, PlotStyle -> Opacity[0.8]],
 lpp,
 AxesLabel -> (Style[#, 14, Bold] & /@ {x, y})]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you very much! It was very kind of you. I have understood how to do it. $\endgroup$
    – VDF
    Nov 2, 2020 at 8:13

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