MATLAB Function Reference Previous page   Next Page
quiver

Quiver or velocity plot

Syntax

Description

A quiver plot displays velocity vectors as arrows with components (u,v) at the points (x,y).

For example, the first vector is defined by components u(1),v(1) and is displayed at the point x(1),y(1).

quiver(x,y,u,v) plots vectors as arrows at the coordinates specified in each corresponding pair of elements in x and y. The matrices x, y, u, and v must all be the same size and contain corresponding position and velocity components. However, x and y can also be vectors, as explained in the next section.

Expanding x and y Coordinates

MATLAB expands x and y if they are not matrices. This expansion is equivalent to calling meshgrid to generate matrices from vectors:

In this case, the following must be true:

length(x) = n and length(y) = m, where [m,n] = size(u) = size(v).

The vector x corresponds to the columns of u and v, and vector y corresponds to the rows of u and v.

quiver(u,v) draws vectors specified by u and v at equally spaced points in the x-y plane.

quiver(...,scale) automatically scales the arrows to fit within the grid and then stretches them by the factor scale. scale = 2 doubles their relative length and scale = 0.5 halves the length. Use scale = 0 to plot the velocity vectors without automatic scaling.

quiver(...,LineSpec) specifies line style, marker symbol, and color using any valid LineSpec. quiver draws the markers at the origin of the vectors.

quiver(...,LineSpec,'filled') fills markers specified by LineSpec.

quiver(axes_handles,...) plots into the axes with handle axes_handle instead of the current axes (gca).

h = quiver(...) returns the handle to the quivergroup object.

Backward Compatible Version

hlines = quiver('v6',...) returns the handles of line objects instead of quivergroup objects for compatibility with MATLAB 6.5 and earlier.

Examples

Showing the Gradient with Quiver Plots

Plot the gradient field of the function:

See Also

contour, LineSpec, plot, quiver3

Direction and Velocity Plots for related functions

Two-Dimensional Quiver Plots for more examples

See Quivergroup Properties for property descriptions


Previous page  quit quiver3 Next page

© 1994-2005 The MathWorks, Inc.