BILINEAR

The BILINEAR function uses a bilinear interpolation algorithm to compute the value of a data array at each of a set of subscript values. The function returns a two-dimensional, floating-point interpolated array.

This routine is written in the IDL language. Its source code can be found in the file bilinear.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = BILINEAR( P, IX, JY )

Arguments

P

A two-dimensional data array.

IX and JY

Arrays containing the X and Y "virtual subscripts" of P to interpolate values for.

IX and JY can be either of the following:

In either case, IX must satisfy the expressions

0 <= MIN(IX) < N0 and 0 < MAX(IX) <= N0

where N0 is the total number of columns in the array P. JY must satisfy the expressions

0 <= MIN(JY) < M0 and 0 < MAX(JY) <= M0

where M0 is the total number of rows in the array P .

It is better to use two-dimensional arrays for IX and JY because the algorithm is somewhat faster. If IX and JY are specified as one-dimensional, the returned two-dimensional arrays IX and JY can be re-used on subsequent calls to take advantage of the faster 2D algorithm.

Example

Create a 3 x 3 floating point array P:

P = FINDGEN(3,3)

Suppose we wish to find the value of a point half way between the first and second elements of the first row of P . Create the subscript arrays IX and JY :

IX = 0.5 ; Define the X subscript.

JY = 0.0 ; Define the Y subscript.

Z = BILINEAR(P, IX, JY) ; Interpolate.

PRINT, Z ; Print the value at the point IX,JY within P.

IDL prints:

0.500000

Suppose we wish to find the values of a 2 x 2 array of points in P . Create the subscript arrays IX and JY :

IX = [[0.5, 1.9], [1.1, 2.2]] ; Define the X subscripts.

JY = [[0.1, 0.9], [1.2, 1.8]] ; Define the Y subscripts.

Z = BILINEAR(P, IX, JY) ; Interpolate.

PRINT, Z ; Print the array of values.

IDL prints:

0.800000    4.60000

4.70000     7.40000

See Also

INTERPOL , INTERPOLATE , KRIG2D