Quiver or velocity plot
h = quiver(...)
A quiver plot displays velocity vectors as arrows with components
For example, the first vector is defined by components
is displayed at the point
vectors as arrows at the coordinates specified in each corresponding
pair of elements in
v must all be the same size and contain corresponding
position and velocity components. However,
also be vectors, as explained in the next section. By default, the
arrows are scaled to just not overlap, but you can scale them to be
longer or shorter if you want.
quiver(u,v) draws vectors
v at equally
spaced points in the x-y plane.
scales the arrows to fit within the grid and then stretches them by
their relative length, and
the length. Use
scale = 0 to plot the velocity
vectors without automatic scaling. You can also
tune the length of arrows after they have been drawn by choosing the Plot
tool, selecting the quiver object, opening the
Property Editor, and adjusting the Length slider.
line style, marker symbol, and color using any valid
the markers at the origin of the vectors.
fills markers specified by
property name and property value pairs for the quiver objects the
quiver(ax,...) plots into
ax instead of into the current axes (
h = quiver(...) returns
they are not matrices. This expansion is equivalent to calling
meshgrid to generate matrices from vectors:
[x,y] = meshgrid(x,y); quiver(x,y,u,v)
In this case, the following must be true:
x corresponds to the columns of
y corresponds to the rows of
quiver to display an arrow at each data point in
y such that the arrow direction and length represent the corresponding values in
[x,y] = meshgrid(0:0.2:2,0:0.2:2); u = cos(x).*y; v = sin(x).*y; figure quiver(x,y,u,v)
Plot the gradient of the function .
[X,Y] = meshgrid(-2:.2:2); Z = X.*exp(-X.^2 - Y.^2); [DX,DY] = gradient(Z,.2,.2); figure contour(X,Y,Z) hold on quiver(X,Y,DX,DY) hold off