![](https://img.51dongshi.com/20240929/wz/18163714252.jpg)
簡單來說就是 二維數(shù)據(jù)插值下面是matlab給出的解釋INTERP2 2-D interpolation (table lookup).ZI = INTERP2(X,Y,Z,XI,YI) interpolates to find ZI, the values of theunderlying 2-D function Z at the points in matrices XI and YI.Matrices X and Y specify the points at which the data Z is given. XI can be a row vector, in which case it specifies a matrix withconstant columns. Similarly, YI can be a column vector and it specifies a matrix with constant rows. ZI = INTERP2(Z,XI,YI) assumes X=1:N and Y=1:M where [M,N]=SIZE(Z).ZI = INTERP2(Z,NTIMES) expands Z by interleaving interpolates betweenevery element, working recursively for NTIMES.INTERP2(Z) is thesame as INTERP2(Z,1). ZI = INTERP2(...,METHOD) specifies alternate methods.The defaultis linear interpolation.Available methods are: 'nearest' - nearest neighbor interpolation'linear'- bilinear interpolation'spline'- spline interpolation'cubic' - bicubic interpolation as long as the data isuniformly spaced, otherwise the same as 'spline' For faster interpolation when X and Y are equally spaced and monotonic,use the syntax ZI = INTERP2(...,*METHOD). ZI = INTERP2(...,METHOD,EXTRAPVAL) specificies a method and a scalar value for ZI outside of the domain created by X and Y.Thus, ZI willequal EXTRAPVAL for any value of YI or XI which is not spanned by Y or X respectively. A method must be specified for EXTRAPVAL to be used,the default method is 'linear'. All the interpolation methods require that X and Y be monotonic andplaid (as if they were created using MESHGRID).If you provide twomonotonic vectors, interp2 changes them to a plaid internally. X and Y can be non-uniformly spaced. For example, to generate a coarse approximation of PEAKS andinterpolate over a finer mesh:[x,y,z] = peaks(10); [xi,yi] = meshgrid(-3:.1:3,-3:.1:3);zi = interp2(x,y,z,xi,yi); mesh(xi,yi,zi) Class support for inputs X, Y, Z, XI, YI: float: double, single