Publication date: 03/23/2021


The Interpolate() function performs linear interpolation for continuous data or bilinear interpolation for two-dimensional continuous data.

In the simplest case, the function finds the y value that corresponds to a given x value between two sets of points. You might use Interpolate() to calculate missing values between data points.

The data points can be specified as alternating ordered arguments:

Interpolate( x, x1, y1, x2, y2, ... );

or as matrices containing the x and y values:

Interpolate( x, xmatrix, ymatrix );

Suppose that your data set includes the height of individuals from age 20 through 25. However, there is no data point for age 23. To estimate the height for 23-year-olds, use interpolation. The following example shows the value that you want to evaluate (age 23), followed by matrices for ages (20 through 25) and heights (59 through 75).

Interpolate( 23, [20 21 22 24 25], [59 62 56 69 75] );



The value 62.5 is halfway between the y values 56 and 69, just as 23 is halfway between the x values 22 and 24.

You can also interpolate multiple points by specifying a matrix or list of values in the first argument.

Interpolate( [23, 24.5], [20 21 22 24 25], [59 62 56 69 75] );


[62.5, 72]

Bilinear Interpolation

You can also interpolate in two-dimensions:

Interpolate( {x, y}, xvector, yvector, zmatrix );

Here, the first argument is a list of two points, the second and third arguments are vectors that define the grid of x and y values, and the fourth argument is a matrix of data points. The function then finds the interpolated z value within the appropriate quadrant of the zmatrix. The appropriate quadrant is found by comparing the x and y values to the xvector and yvector arguments.

Suppose you have a 2x3 matrix and you want to interpolate a point that is halfway between the first and second rows of points and halfway between the second and third columns of points.

Interpolate( {0.5, 0.75}, [0 1], [0 0.5 1], [10 15 20, 12 16 18] );



Note that 0.5 is halfway between 0 and 1 for the x values (corresponding to the rows of the matrix) and 0.75 is halfway between 0.5 and 1 for the y values (corresponding to the columns of the matrix). You can find the bilinear interpolation in two steps:

1. Find the halfway points between the second and third columns for the each row of the matrix:

Row 1: 17.5 is halfway between 15 and 20.

Row 2: 17 is halfway between 16 and 18.

2. Find the halfway point between the two points in the previous step: 17.25.


The x values must be in ascending order. For example, Interpolate(2,1,1,3,3) returns 2. However, Interpolate(2,3,3,1,1) returns a missing value (.).

Interpolate() is best used for continuous data, but Step() is designed for discrete data. See Step.

Want more information? Have questions? Get answers in the JMP User Community (