The BILINEAR function uses a bilinear interpolation algorithm to compute the value of a data array at each of a set of subscript values.
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.
Result = BILINEAR(P, IX, JY)
This function returns a two-dimensional interpolated array of the same type as the input array.
A two-dimensional data array.
Arrays containing the X and Y "virtual subscripts" of P for which to interpolate values. IX and JY can be either of the following:
P. One-dimensional arrays will be converted to two-dimensional arrays in such a way that IX contains n identical rows and JY contains n identical columns.IX array) and the Y subscripts (the JY array) of the points to be computed from the input array P.
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.
None.
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
Introduced: Original