[ZX,ZY] = TRIGRADIENT(X,Y,Z,T) returns an approximation to the gradient of Z defined on the delaunay triangulation T. ZX corresponds to the gradient in the x direction, dZ/dX, and ZY corresponds to the gradient in the y direction dZ/dY.
If Z is a matrix of size MxN then ZX and ZY will be computed for each of the N columns of Z.
[ZX,ZY] = TRIGRADIENT(X,Y,Z) returns an approximation to the gradient of Z for the scattered data (X,Y).
[ZX,ZY] = TRIGRADIENT(X,Y,Z,'face') returns the value of the of the gradient for each triangular face assuming Z is a piece-wise planar function. ZX(1) is an approximation to the gradient in the x direction of the function Z for the triangle defined by the nodes [x(T(1,:)), y(T(1,:))].
Trigradient uses a first order approximation. Z is assumed to be a piece-wise planar function over the triangulated region. The partial derivative of each plane (ax + by + c = z) is a in the x direction and b in the y direction. A given node in the triangulation is associated with k triangles. The partial derivative at each node is the weighted sum of each of the partial derivatives of the triangles associated with that node. The weightings are the areas of each triangle divided by the total area of all triangles associated with that node.