1
$\begingroup$

I have a $3D$ space, if I had a square in this space:

square = {{ 0, 0, 100}, { 100, 100, 50}, { 0, 100, 22}, { 100, 0, 86}};

how could I get the average height of any point in this field where 0 < x < 100 and 0 < y < 100?

For example I want the z value on x == 40 && y == 33.

$\endgroup$
  • $\begingroup$ yes, probably you didn't understand my question correctly, i don't want the distance between points, i want to generate a 'height' for given x,y points if i knew the heights for 0,0 100,0 0,100 and 100,100 $\endgroup$ – Ronan Dejhero May 12 '14 at 10:35
  • 2
    $\begingroup$ Do you want to interpolate a z-value between those points? $\endgroup$ – Yves Klett May 12 '14 at 11:41
  • 1
    $\begingroup$ Plot3D[Interpolation[{{0, 0, 100}, {0, 100, 22}, {100, 100, 50}, {100, 0, 86}}, {x, y}, InterpolationOrder -> 1], {x, 0, 100}, {y, 0, 100}] ? $\endgroup$ – Kuba May 12 '14 at 12:45
6
$\begingroup$

It sounds like you want a bilinear interpolation:

f = Interpolation[square, InterpolationOrder -> 1];
f[40, 33]//N
(* 74.204 *)
$\endgroup$
  • $\begingroup$ Exactly ! the image on wikipedia looks just like what i am doing ... now the problem is to convert that to a code ... thanks :) $\endgroup$ – Ronan Dejhero May 19 '14 at 15:26

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.