0
$\begingroup$

I would like to do a ListPlot3D of an empirical function where variables c and d are my x and y axes and tkappa is my z.

I either get an empty plot or axis ranges that do not correspond to values of c, d or tkappa.

If I use the code below; I get an empty plot but the axis ranges are correct.

tkappa[a_,b_,c_,d_]:= 0.67 - 0.07*a - 0.17*b + 0.40*c + 0.32*d + 0.16*a*b + 0.13*a*c-8.093*10^-4*a*d + 0.13*b*c + 0.084*b*d + 0.27*c*d - 0.10*a*b*c + 0.016*a*b*d+0.051*a*c*d + 0.16*b*c*d -0.059*a*b*c*d;
timingData = Table[{c,d,tkappa[0,0,c,d]},{c,0,1,0.1},{d,0,1,0.1}]
ListPlot3D[timingData]

If I use a Table function as an argument for ListPlot3D, I get a surface but the axis ranges don't seem to correspond to c, d or values for tkappa.

ListPlot3D[Table[tkappa[0,0,c,d],{c,0,1,0.1},{d,0,1,0.1}]]

What is the best approach for ListPlot3D for x,y,z plots?

$\endgroup$
  • 1
    $\begingroup$ You want ListPlot3D[Flatten[timingData,1]].. Look the usage of ListPlot3D up. It expects a 1d list of 3d points. $\endgroup$ – halirutan Mar 23 '17 at 17:21
  • $\begingroup$ closely related: 66078 $\endgroup$ – Kuba Mar 23 '17 at 19:40
2
$\begingroup$

The data feed to ListPlot3D should be of the form {{x1,y1,z1},{x2,y2,z2},....}

 timingData = Partition[
              Flatten[Table[{c, d, tkappa[0, 0, c, d]}, {c, 0, 1, 0.1}, {d, 0, 1,0.1}]],
              3];


 ListPlot3D[timingData]

enter image description here

$\endgroup$

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.