Plot the
(
u,
v)
components of a vector field in an(
x,
y)
meshgrid. If the grid is uniform, you can specify x and y as vectors.If x and y are undefined they are assumed to be
(1:
m, 1:
n)
where[
m,
n] = size(
u)
.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 1.
The style to use for the plot can be defined with a line style style in a similar manner to the line styles used with the
plot
command. If a marker is specified then markers at the grid points of the vectors are printed rather than arrows. If the argument 'filled' is given then the markers as filled.The optional return value h provides a quiver group that regroups the components of the quiver plot (body, arrow and marker), and allows them to be changed together
[x, y] = meshgrid (1:2:20); h = quiver (x, y, sin (2*pi*x/10), sin (2*pi*y/10)); set (h, "maxheadsize", 0.33);See also: plot
The following code
[x,y] = meshgrid(1:2:20); h = quiver(x,y,sin(2*pi*x/10),sin(2*pi*y/10)); set (h, "maxheadsize", 0.33);
Produces the following figure
![]() |
The following code
axis("equal"); x=linspace(0,3,80); y=sin(2*pi*x); theta=2*pi*x+pi/2; quiver(x,y,sin(theta)/10,cos(theta)/10); hold on; plot(x,y,"r"); hold off;
Produces the following figure
![]() |