Interpolate from PDE triangular mesh to rectangular grid


uxy = tri2grid(p,t,u,x,y)
[uxy,tn,a2,a3] = tri2grid(p,t,u,x,y)
uxy = tri2grid(p,t,u,tn,a2,a3)


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. u must be a vector. For systems of equations, uxy interpolates only the first component. For solutions returned by hyperbolic or parabolic, pass u as the vector of values at one time, u(:,k).

[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, such as interpolating hyperbolic or parabolic solutions at multiple times.

All tri2grid output arguments are ny-by-nx matrices, where nx and ny are the number of elements of the vectors x and y respectively. At grid points outside of the triangular mesh, all tri2grid output arguments are NaN.

To interpolate all components of systems of equations, or to interpolate at all times in one call, use pdeInterpolant along with the evaluate function instead of tri2grid.

Was this topic helpful?