# quiver

## Purpose

Quiver or needle plot.

## Synopsis

````quiver(X,Y,DX,DY)`
`quiver(DX,DY)`
`quiver(x,y,dx,dy,s)`
`quiver(dx,dy,s)`
`quiver(....'linetype')`
```

## Description

`quiver(X,Y,DX,DY) `draws arrows at every pair of elements in matrices `X` and `Y`. The pairs of elements in matrices `DX` and `DY` determine the direction and relative magnitude of the arrows. If `X` and `Y` are vectors, they must have `length(x) = n` and `length(y) = m` where` [m,n] = size(DX) = size(DY)`. In this case, the arrows represent `(x(j),y(i),DX(i,j), DY(i,j))`. Note that vector `X` corresponds to the columns of `DX` and `DY` and `Y` corresponds to the rows.

`quiver(DX,DY)` uses `x = 1:n` and `y = 1:m`. In this case `DX` and `DY` are defined over a geometrically rectangular grid.

`quiver(x,y,dx,dy,s)` and `quiver(dx,dy,s)` apply scalar `s` as a scale factor to the lengths of the arrow. For example, `s = 2` doubles their relative length and `s = 0.5` halves them.

A final trailing string argument `linetype` specifies line type and color using any legal line specification as described under the `plot` command.

## Examples

Plot the gradient field of the function

````[x,y] = meshgrid(-2:.2:2);`
`z = x.*exp(-x.^2-y.^2);`
`[dx,dy] = gradient(z,.2,.2);`
`contour(x,y,z)`
`hold on`
`quiver(x,y,dx,dy)`
`hold off`
`          `

```

````contour`, `plot`
```

(c) Copyright 1994 by The MathWorks, Inc.