surfnorm
Compute or display surface normal vectors.
📝Syntax
surfnorm(Z)
surfnorm(X, Y, Z)
Nx = surfnorm(...)
[Nx, Ny] = surfnorm(...)
[Nx, Ny, Nz] = surfnorm(...)
📥Input Arguments
Parameter Description
Z Surface height data, specified as a real numeric matrix with at least three rows and three columns.
X, Y Surface coordinate matrices with the same size as Z.
📤Output Arguments
Parameter Description
Nx, Ny, Nz Normalized surface normal vector components.
📄Description

surfnorm computes unit normal vectors for a surface. With no output arguments, it displays the surface and draws one normal segment at each surface point.

When only Z is specified, the x- and y-coordinates are the column and row indices of Z.

💡Examples
Display normals on a surface.
[X, Y, Z] = peaks(20);
surfnorm(X, Y, Z);
Example illustration
Compute normal vector components.
[Nx, Ny, Nz] = surfnorm(peaks(10));
🔗See Also
surfquiver3meshgrid
Edit this page on GitHub