Documentation Center |
Scattered data interpolation
Use scatteredInterpolant to perform interpolation on a 2-D or 3-D Scattered Data set. For example, you can pass a set of (x,y) points and values, v, to scatteredInterpolant, and it returns a surface of the form v = F(x, y). This surface always passes through the sample values at the point locations. You can evaluate this surface at any query point, (xq,yq), to produce an interpolated value, vq.
Use scatteredInterpolant to create the Interpolant, F. Then, you can evaluate F at specific points using any of the following syntaxes:
Vq = F(Pq) specifies the query points in the matrix Pq. Each row in Pq contains the coordinates of a query point.
Vq = F(Xq,Yq) and Vq = F(Xq,Yq,Zq) specify the query points as two or three matrices of equal size.
Vq = F({xq,yq}) and Vq = F({xq,yq,zq}) specify the query points as Grid Vectors. The interpolated values are returned in Vq. Use this syntax to conserve memory when you want to query a large grid of points.
F = scatteredInterpolant(x,y,v) creates an interpolant that fits a surface of the form v = F(x,y). Vectors x and y specify the (x,y) coordinates of the sample points. v is a vector that contains the sample values associated with the points, (x,y).
F = scatteredInterpolant(x,y,z,v) creates a 3-D interpolant of the form v = F(x,y,z).
F = scatteredInterpolant(P,v) specifies the coordinates of the sample points as an array. The rows of P contain the (x, y) or (x, y, z) coordinates for the values in v.
F = scatteredInterpolant(___,Method) specifies a string that describes an interpolation method: 'nearest', 'linear', or 'natural'. Specify Method as the last input argument in any of the first three syntaxes.
F = scatteredInterpolant(___,Method,ExtrapolationMethod) specifies both the interpolation and extrapolation methods as strings. Method can be one of three strings: 'nearest', 'linear', or 'natural'. Specify ExtrapolationMethod as one of the following strings: 'nearest', 'linear', or 'none'. Pass Method and ExtrapolationMethod together as the last two input arguments in any of the first three syntaxes.
F = scatteredInterpolant() creates an empty scattered data interpolant. Use F.Points = P to initialize F with the points in matrix P. Use F.Values = v to initialize F with the values in v.
Points |
Array of sample points (locations) for the values in F.Values. Each row of F.Points contains the (x, y) or (x, y, z) coordinates of a sample point. |
Values |
Vector of values associated with each point in F.Points. |
Method |
A string specifying the method used to interpolate the data: 'nearest', 'linear', or 'natural'. |
ExtrapolationMethod |
A string specifying the method used to extrapolate the data: 'nearest', 'linear', or 'none'. A value of 'none' indicates that extrapolation is disabled. |
Interpolating function that you can evaluate at query locations.
A set of points that have no structure among their relative locations.
A grid represented as a set of arrays. For example, you can create a full grid using ndgrid.
A set of vectors that serve as a compact representation of a grid in ndgrid format. For example, [X,Y] = ndgrid(xg,yg) returns a full grid in the matrices X and Y. You can represent the same grid using the grid vectors, xg and yg.
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB^{®} documentation.
scatteredInterpolant supports index-based editing of the properties of F. You can add or remove points in F.Points and update the corresponding values in F.Values. For example, F.Points(5,:) = [] removes the fifth point, and F.Values(5) = [] removes the corresponding value.
griddedInterpolant | interp1 | interp2 | interp3 | meshgrid | ndgrid