0

I have (x,y) points and how to find (x1,y1),(x1,y2),(x2,y1),(x2,y2) grid points in the set of data points(xi,yi)...

grid points

kamal
  • 21
  • 1
  • 1
  • 5
  • You are computing the points needed to perform bilinear interpolation. Check the marked duplicate for more details on how to do it. – rayryeng Nov 25 '16 at 15:03

1 Answers1

0

Have a look at ceil and floor.

They will round up and down a value, thus ceil(3.2) will output 4 and floor(3.2) will output 3. The right combinations of ceil/floor x and y will give all the points you need.

Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
  • thanks Ander Biguri but this is not work for all cases. bcoz of the reason is my all grid points are in decimal no. only. (like, x=[0 0.1 0.2 0.3 0.4 0.5],y=[1 1.1 1.2 1.3 1.4 1.5], and i need [0.25,1.35]'s nearest grid points as [(0.2,1.3),(0.2,1.4),(0.3,1.3),(0.3,1.4)] – kamal Nov 25 '16 at 12:29
  • @kamal Multiply by ten you data........ – Ander Biguri Nov 25 '16 at 13:19