TRIGRADIENT.M

版本 1.7.0.0 (2.3 KB) 作者: Mick Warehime
Fast approximation to the gradient for scattered data and for data defined by a triangulation.
1.1K 次下载
更新时间 2013/4/8

查看许可证

[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.

引用格式

Mick Warehime (2024). TRIGRADIENT.M (https://www.mathworks.com/matlabcentral/fileexchange/36837-trigradient-m), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Delaunay Triangulation 的更多信息
致谢

参考作品: Contours for triangular grids

启发作品: Gypaets/trigradient2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.7.0.0

Fixed example code.
Fixed bug with number of inputs/options checks.

1.5.0.0

Code is now entirely vectorized. It no longer loops over each node.

Option to allow output of the gradient of individual triangular planes has been added.

1.4.0.0

Found another typo in comments

1.3.0.0

Corrected a typo in the error output.

1.2.0.0

Fixed typos to handle z with multiple columns. Changed several typos in help documentation. Removed two ~ to prevent earlier versions from crashing.

1.0.0.0