发布日期: 04/13/2021

Interpolate

The Interpolate() function finds the y value corresponding to a given x value between two points (x1, y1 and x2, y2). A linear interpolation is applied to the values. You might use Interpolate() to calculate missing values between data points.

The data points can be specified as a list:

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 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] );

returns:

62.5

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.

The data points in each list or matrix must create a positive slope. 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 for discrete data. See Step.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).