%% Specify Arrow Color
% Create a 3-D quiver plot and specify a color for the arrows.
% For example, first return the x-, y-, and z- coordinates of a surface. Calculate the directional components of its surface normals using the surfnorm function.

[X,Y] = meshgrid(-pi/2:pi/8:pi/2,-pi/2:pi/8:pi/2);
Z = sin(X) + cos(Y);
[U,V,W] = surfnorm(Z);

% Then, create a 3-D quiver plot with red arrows.

quiver3(X,Y,Z,U,V,W,'r')
axis equal

% Copyright 2020 The MathWorks, Inc.