Member of the vector class.
d = divergence(Fx, Fy)
d = divergence(dx, dy, Fx, Fy)
Computes the divergence of a two-dimensional vector field.
| Name | Description |
| dx | Specifies the spacing between points along the x-axis or between values of the second dimension in a 2D array. dx is an array of double-precision, floating-point numbers. The default is 1. |
| dy | Specifies the spacing between points along the y-axis or between values of the first dimension in a 2D array. dy is an array of double-precision, floating-point numbers. The default is 1. |
| Fx | Specifies the x-components of a two-dimensional vector field. Fx is a 2D array of double-precision, floating-point numbers. |
| Fy | Specifies the y-components of a two-dimensional vector field. Fy is a 2D array of double-precision, floating-point numbers. size(Fy) must equal size(Fx). |
| Name | Description |
| d | Returns the z-components of the divergence of the vector field. d is of the same dimensions and data type as Fx. |
You can specify the spacing between the points of the curl in two ways. If either dx or dy contains only one element, the spacing between two consecutive points in the corresponding axis is constant. If either dx or dy contains more than one element, the values of the elements specify the coordinates of the points in the corresponding axis. In this case, the length of dx or dy must conform to the corresponding dimension of the vector field.
FX = rand(3, 4);
FY = rand(3, 4);
D = divergence(1:4, 1:3, FX, FY)