1 function v=bint2(a,x,y)
\r
2 % v=interp_b2d(a,x,y)
\r
3 % bilinear interpolation from a to position x,y
\r
4 % Jan Mandel, February 2006
\r
7 if(x<1 | x>m | y<1 | y > n),
\r
8 error('arg out of range')
\r
10 % map to lower left corner
\r
11 i=min(floor(x),m-1);
\r
12 j=min(floor(y),n-1);
\r
15 v=a(i,j)*(1-t)*(1-u)+a(i+1,j)*t*(1-u)+a(i,j+1)*(1-t)*u+a(i+1,j+1)*t*u;
\r
16 %err=v-interp2(a',x,y)
\r