Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

**Class: **TriScatteredInterp

(Not recommended) Interpolate scattered data

`TriScatteredInterp`

is not recommended. Use `scatteredInterpolant`

instead.

`F = TriScatteredInterp()`

F = TriScatteredInterp(X, V)

F = TriScatteredInterp(X, Y, V)

F
= TriScatteredInterp(X, Y, Z, V)

F = TriScatteredInterp(DT, V)

F = TriScatteredInterp(..., method)

`F = TriScatteredInterp()`

creates an empty
scattered data interpolant. This can subsequently be initialized with
sample data points and values (`Xdata`

, `Vdata`

)
via `F.X = Xdata`

and `F.V = Vdata`

.

`F = TriScatteredInterp(X, V)`

creates an
interpolant that fits a surface of the form `V = F(X)`

to
the scattered data in (`X`

, `V`

). `X`

is
a matrix of size `mpts`

-by-`ndim`

,
where `mpts`

is the number of points and `ndim`

is
the dimension of the space where the points reside (`ndim`

is
2 or 3). The column vector `V`

defines the values
at `X`

, where the length of `V`

equals `mpts`

.

`F = TriScatteredInterp(X, Y, V)`

and ```
F
= TriScatteredInterp(X, Y, Z, V)
```

allow the data point
locations to be specified in alternative column vector format when
working in 2-D and 3-D.

`F = TriScatteredInterp(DT, V)`

uses the
specified `DelaunayTri`

object `DT`

as
a basis for computing the interpolant. `DT`

is a
Delaunay triangulation of the scattered data locations, `DT.X`

.
The matrix `DT.X`

is of size `mpts`

-by-`ndim`

,
where `mpts`

is the number of points and `ndim`

is
the dimension of the space where the points reside, ```
2 <=
ndim <= 3
```

. `V`

is a column vector that
defines the values at `DT.X`

, where the length of `V`

equals `mpts`

.

`F = TriScatteredInterp(..., method)`

allows
selection of the technique `method`

used to interpolate
the data.

`X` | Matrix of size `mpts` -by-`ndim` ,
where `mpts` is the number of points and `ndim` is
the dimension of the space where the points reside. Input may also
be specified as column vectors (`X` , `Y` )
or (`X` , `Y` , `Z` ) | |

`V` | Column vector that
defines the values at `X` , where the length of `V` equals `mpts` . | |

`DT` | Delaunay triangulation of the scattered data locations | |

`method` | `natural` | Natural neighbor interpolation |

`linear` | Linear interpolation (default) | |

`nearest` | Nearest-neighbor interpolation |

`F` | Creates an interpolant that fits a surface of the form ```
V
= F(X)
``` to the scattered data. |

To evaluate the interpolant, express the statement in Monge's
form `Vq = F(Xq)`

, `Vq = F(Xq,Yq)`

,
or `Vq = F(Xq,Yq,Zq)`

where `Vq`

is
the value of the interpolant at the query location and `Xq`

, `Yq`

,
and `Zq`

are the vectors of point locations.

Create a data set:

x = rand(100,1)*4-2; y = rand(100,1)*4-2; z = x.*exp(-x.^2-y.^2);

F = TriScatteredInterp(x,y,z);

`(qx, qy)`

. The
corresponding value at these locations is `qz`

.ti = -2:.25:2; [qx,qy] = meshgrid(ti,ti); qz = F(qx,qy); mesh(qx,qy,qz); hold on; plot3(x,y,z,'o');

`delaunayTriangulation`

| `interp1`

| `interp2`

| `interp3`

| `meshgrid`

Was this topic helpful?