Plot a 3-D vector field with arrows.
Plot the (u, v, w) components of a vector field in an (x, y, z) meshgrid. If the grid is uniform then x, y, and z can be specified as vectors.
If x, y, and z are undefined they are assumed to be
(1:m, 1:n, 1:p)
where [m, n] =
size (u)
and p = max (size (w))
.
The variable s is a scalar defining a scaling factor to use for the arrows of the field relative to the mesh spacing. A value of 0 disables all scaling. The default value is 0.9.
The style to use for the plot can be defined with a line style style
of the same format as the plot
command.
If a marker is specified then markers at the grid points of the vectors are
drawn rather than arrows. If the argument "filled"
is given then
the markers are filled.
If the first argument hax is an axes handle, then plot into this axis,
rather than the current axes returned by gca
.
The optional return value h is a graphics handle to a quiver object. A quiver object regroups the components of the quiver plot (body, arrow, and marker), and allows them to be changed together.
[x, y, z] = peaks (25); surf (x, y, z); hold on; [u, v, w] = surfnorm (x, y, z / 10); h = quiver3 (x, y, z, u, v, w); set (h, "maxheadsize", 0.33);
See also: quiver, compass, feather, plot.
The following code
clf; colormap ("default"); [x, y, z] = peaks (25); surf (x, y, z); hold on; [u, v, w] = surfnorm (x, y, z / 10); h = quiver3 (x, y, z, u, v, w); set (h, "maxheadsize", 0.25); hold off; title ("quiver3 of surface normals to peaks() function");
Produces the following figure
Figure 1 |
---|
The following code
clf; colormap ("default"); [x, y, z] = peaks (25); surf (x, y, z); hold on; [u, v, w] = surfnorm (x, y, z / 10); h = quiver3 (x, y, z, u, v, w); set (h, "maxheadsize", 0.25); hold off; shading interp; title ({"quiver3 of surface normals to peaks() function"; ... 'shading "interp"'});
Produces the following figure
Figure 1 |
---|
Package: octave