Partial Differential Equation Toolbox | ![]() ![]() |
Interpolate from PDE triangular mesh to rectangular grid
Syntax
Description
uxy=tri2grid(p,t,u,x,y)
computes the function values uxy
over the grid defined by the vectors x
and y
, from the function u
with values on the triangular mesh defined by p
and t. Values are computed using linear interpolation in the triangle containing the grid point. The vectors x
and y
must be increasing.
[uxy,tn,a2,a3]=tri2grid(p,t,u,x,y)
additionally lists the index tn
of the triangle containing each grid point, and interpolation coefficients a2
and a3
.
uxy=tri2grid(p,t,u,tn,a2,a3)
, with tn
, a2
, and a3
computed in an earlier call to tri2grid
, interpolates using the same grid as in the earlier call. This variant is, however, much faster if several functions have to be interpolated using the same grid.
For grid points outside of the triangular mesh, NaN
is returned in uxy
, tn
, a2
, and a3
.
See Also
initmesh
, refinemesh
, assempde
![]() | sptarn | wbound | ![]() |