Documentation

### This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# quiver3

3-D quiver or velocity plot ## Syntax

```quiver3(x,y,z,u,v,w) quiver3(z,u,v,w) quiver3(...,scale) quiver3(...,LineSpec) quiver3(...,LineSpec,'filled') quiver3(...,'PropertyName',PropertyValue,...) quiver3(ax,...) h = quiver3(...) ```

## Description

A three-dimensional quiver plot displays vectors with components `(u,v,w)` at the points `(x,y,z)`, where `u`, `v`, `w`, `x`, `y`, and `z` all have real (non-complex) values.

`quiver3(x,y,z,u,v,w)` plots vectors with directions determined by components `(u,v,w)` at points determined by `(x,y,z)`. The matrices `x`,`y`,`z`,`u`,`v`, and `w` must all be the same size and contain the corresponding position and vector components.

`quiver3(z,u,v,w)` plots vectors with directions determined by components `(u,v,w)` at equally spaced points along the surface `z`. For each vector `(u(i,j),v(i,j),w(i,j))`, the column index `j` determines the x-value of the point on the surface, the row index `i` determines the y-value, and `z(i,j)` determines the z-value. That is, `quiver3` locates the vector at the point on the surface `(j,i,z(i,j))`. The `quiver3` function automatically scales the vectors to prevent overlapping based on the distance between them.

`quiver3(...,scale)` automatically scales the vectors to prevent them from overlapping, and then multiplies them by `scale`. `scale` `=` `2` doubles their relative length, and `scale` `=` `0.5` halves them. Use `scale = 0` to plot the vectors without the automatic scaling.

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

`quiver3(...,LineSpec,'filled')` fills markers specified by `LineSpec`.

`quiver3(...,'PropertyName',PropertyValue,...)` specifies property name and property value pairs for the quiver chart that the function creates.

`quiver3(ax,...)` plots into the axes `ax` instead of into the current axes (`gca`).

`h = quiver3(...)` returns the `Quiver` object.

## Examples

collapse all

Define the data.

```x = -3:0.5:3; y = -3:0.5:3; [X,Y] = meshgrid(x, y); Z = Y.^2 - X.^2; [U,V,W] = surfnorm(Z);```

Plot vectors with components `(U,V,W)` at points that are equally spaced in the x-direction and y-direction with heights determined by `Z`.

```figure quiver3(Z,U,V,W) view(-35,45)``` Plot the surface normals of the function $z=x{e}^{-{x}^{2}-{y}^{2}}$.

```[X,Y] = meshgrid(-2:0.25:2,-1:0.2:1); Z = X.* exp(-X.^2 - Y.^2); [U,V,W] = surfnorm(X,Y,Z); figure quiver3(X,Y,Z,U,V,W,0.5) hold on surf(X,Y,Z) view(-35,45) axis([-2 2 -1 1 -.6 .6]) hold off``` 