MATLAB Function Reference    

Quiver or velocity plot



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 componets 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 specifide in each corresponding pair of elements in X and Y. The matirces X, Y, U, and V must all be the same size and contain corresponding position and velocity components.

Expanding X and Y Coordinates

MATLAB expandes 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 the 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.

h = quiver(...) returns a vector of line handles.


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

  quit quiver3