Version:

Last Modified: March 15, 2017

Interpolates *z*-values based on sample data using a specified method.

z2 = interpolate2d(z1, times)

z2 = interpolate2d(z1, x2, y2)

z2 = interpolate2d(x1, y1, z1, x2, y2)

z2 = interpolate2d(x1, y1, z1, x2, y2, method)Legacy name: interp2

Sample *z*-values. z1 is a real matrix.

Number of times MathScript must interpolate recursively between the given points. Specifically, MathScript adds 2^(times)-1 points between each given set of points. times is an integer.

X-values at which you want to interpolate *z*-values. x2 is a row vector or a matrix of real numbers.

Y-values at which you want to interpolate *z*-values. If x2 is a row vector, y2 must be a real column vector. If x2 is a matrix, y2 must be a real matrix of the same size as x2 .

Sample x-values. If you do not specify x1, MathScript sets x1 to the values of 0 ... *m*- 1 , where [*m*, *n*] equals size( z1 ). x1 is a real vector.

Name | Description |
---|---|

'cubic' | Performs cubic Hermite interpolation. |

'linear' | Performs linear interpolation. |

'nearest' | Chooses the z1 value corresponding to the (x1, y1) value that is nearest to the current z2 value. MathScript sets the interpolated value to the nearest data point. |

'spline' | Performs spline interpolation. |

**Default: **'linear'

Sample y-values. If you do not specify y1, MathScript sets y1 to the values of 0 ... *n*- 1 , where [*m*, *n*] equals size( z1 ). y1 is a real vector.

Interpolation method to use. method is a string that accepts the following values:

Name | Description |
---|---|

'cubic' | Performs cubic Hermite interpolation. |

'linear' | Performs linear interpolation. |

'nearest' | Chooses the z1 value corresponding to the ( x1, y1 ) value that is nearest to the current z2 value. MathScript sets the interpolated value to the nearest data point. |

'spline' | Performs spline interpolation. |

**Default: **'linear'

*z*-values interpolated at the values of ( x2 , y2 ). z2 is a real matrix.

Z1 = zeros(10, 10); for i = 1:10 for k = 1:10 Z1(i, k) = i^2+4*i+3*k^4-2*k; end end Z2 = interpolate2d(Z1, 2);

**Where This Node Can Run: **

Desktop OS: Windows

FPGA: This product does not support FPGA devices