orientation gradient along the two lattice directions
Works on any EBSD - a plain list, a phase subset, a gridified map - by placing every pixel on the virtual lattice ebsd.lattice derives from the unit cell, so it needs neither a matrix layout nor an axis aligned grid. A rotated or sheared grid is handled by the same code.
Description
Three stencils are available. All of them skip a neighbour that is not comparable - outside the map, notIndexed, a different phase, or across a grain boundary where grainId is known.
'oneSided' (default) takes the neighbour at +a_k, and falls back to -a_k (negated) only where +a_k lies outside the map. A missing neighbour inside the map yields NaN and does NOT fall back, which is what the matrix based EBSDsquare/gradient1 does and what keeps existing GND / WBV numbers unchanged. This is why it stays the default: the other two move every number that depends on the gradient.
'1hop' is a least squares fit over the lattice's own neighbour stencil, ebsd.lattice.stencil - the 4 axial neighbours of a square grid, the 6 neighbours of a hex one. Symmetric, and in the interior of a square grid exactly the central difference.
'full' is the same fit over all eight offsets in {-1,0,1}^2, i.e. the 1-hop stencil plus the diagonals. On a square grid that is the full 8 neighbourhood; on a hex grid it adds the two second nearest neighbours along a1+a2. Still symmetric, and better conditioned - a pixel needs two independent directions to be solvable at all, so the wider stencil leaves far fewer pixels NaN (18 against 374 on forsterite). The fit uses each neighbour's true physical offset, so mixing the two distances is handled correctly, but note it does weight every neighbour equally rather than by distance.
Before MTEX 7 'leastSquares' used a hardcoded six offset list on every grid. That is the hex stencil, and on a square grid it is 4 axial plus TWO of the four diagonals - an asymmetric neighbourhood which biased the fit along one diagonal, by up to 0.042 (mean 0.0009) on forsterite. Its comment claimed those offsets did not exist on a square lattice; they do.
Syntax
g = gradient(ebsd) % one sided (default)
g = gradient(ebsd,'stencil','oneSided') % the same, explicitly
g = gradient(ebsd,'stencil','1hop') % least squares, 1-hop stencil
g = gradient(ebsd,'stencil','full') % least squares, full stencil
g = gradient(ebsd,'leastSquares') % alias for 'stencil','1hop'
g = gradient(ebsd,'basis',[a1 a2]) % use an explicit basis
[g,A] = gradient(ebsd)Input
| ebsd | EBSD |
Output
| g | length(ebsd) × 2 vector3d, g(:,k) = d(orientation) / d(a_k), in the left tangent space, i.e. log(ori(p+a_k),ori(p))/|a_k| |
| A | 2 × 2 basis actually used, columns a1, a2 (map plane components) |
Options
| stencil | which neighbours the gradient is computed from, see below |
| basis | 1x2 vector3d, use these as (a1,a2) instead of the ones derived from the unit cell |
Flags
| leastSquares | alias for |'stencil','1hop'| |
See also
Citing this page.
This page is part of the documentation of
MTEX, a free and open
source MATLAB toolbox for analyzing and modeling crystallographic textures.
It was written by The MTEX Developers and is published at
https://mtex-toolbox.github.io/EBSD.gradient.html.
If you use MTEX, or reuse text or figures from this page, in your research,
please cite
F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63
BibTeX
@article{bachmann2010mtex,
author = {F. Bachmann and R. Hielscher and H. Schaeben},
title = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
journal = {Solid State Phenomena},
volume = {160},
pages = {63-68},
year = {2010},
doi = {10.4028/www.scientific.net/SSP.160.63},
url = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}
Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.