| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
In the section Interpolating Uniform Data, the interpolation technique leveraged the uniformity or gridlike nature of the sample data to compute interpolated values.
When the sample data is scattered, the interpolation techniques use a triangulation-based approach as a basis for computing interpolated values. There are many ways to create a triangulation, but the triangulation that is best suited to interpolation is the Delaunay triangulation. TriScatteredInterp is a class for performing scattered data interpolation based on an underlying Delaunay triangulation. A scattered data set defined by locations X and corresponding values V can be interpolated using a Delaunay triangulation of X. This produces a surface of the form V = F(X). The surface can be evaluated at any query location QX, using QV = F(QX), where QX lies within the convex hull of X. The interpolant F always goes through the data points specified by the sample.
Construct the interpolant with TriScatteredInterp:
F = TriScatteredInterp(x,y,z)
TriScatteredInterp
Properties:
X: [100x2 double]
V: [100x1 double]
Method: 'linear'
MethodsEvaluate the interpolant at the locations (qx, qy):
ti = -2:.25:2; [qx,qy] = meshgrid(ti,ti);
Find the corresponding value of the interpolant at [qx,qy]:
qz = F(qx,qy);
Plot the result:
mesh(qx,qy,qz); hold on; plot3(x,y,z,'o'); hold off

You can insert additional points into the interpolation by editing the X and V properties of F:
x1 = rand(5,1)*4-2;
y1 = rand(5,1)*4-2;
v1 = x1.*exp(-x1.^2-y1.^2);
F.V(end+(1:5)) = v1;
F.X(end+(1:5), :) = [x1, y1];
F
F =
TriScatteredInterp
Properties:
X: [105x2 double]
V: [105x1 double]
Method: 'linear'
You can also use the Delaunay triangulation as the basis for computing the interpolant:
x = rand(100,1)*4-2; y = rand(100,1)*4-2; v = x.*exp(-x.^2-y.^2); dt=DelaunayTri(x,y); F=TriScatteredInterp(dt,v);
![]() | Interpolating Uniform Data | Function Functions | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |