Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# streamslice

Plot streamlines in slice planes

## Syntax

streamslice(X,Y,Z,U,V,W,startx,starty,startz)
streamslice(U,V,W,startx,starty,startz)
streamslice(X,Y,U,V)
streamslice(U,V)
streamslice(...,density)
streamslice(...,'arrowsmode')
streamslice(...,'method')
streamslice(axes_handle,...)
h = streamslice(...)
[vertices arrowvertices] = streamslice(...)

## Description

streamslice(X,Y,Z,U,V,W,startx,starty,startz) draws well-spaced streamlines (with direction arrows) from vector data U, V, W in axis aligned x-, y-, z-planes at the points in the vectors startx, starty, startz. The section Specifying Starting Points for Stream Plots provides more information on defining starting points.

The arrays X, Y, and Z, which define the coordinates for U, V, and W, must be monotonic, but do not need to be uniformly spaced. X, Y, and Z must have the same number of elements, as if produced by meshgrid. U, V, W must be m-by-n-by-p volume arrays.

Do not assume that the flow is parallel to the slice plane. For example, in a stream slice at a constant z, the z component of the vector field W is ignored when you are calculating the streamlines for that plane.

Stream slices are useful for determining where to start streamlines, stream tubes, and stream ribbons.

streamslice(U,V,W,startx,starty,startz) assumes X, Y, and Z are determined by the expression

```[X,Y,Z] = meshgrid(1:n,1:m,1:p)
```

where [m,n,p] = size(U).

streamslice(X,Y,U,V) draws well-spaced streamlines (with direction arrows) from vector volume data U, V.

The arrays X and Y, which define the coordinates for U and V, must be monotonic, but do not need to be uniformly spaced. X and Y must have the same number of elements, as if produced by meshgrid.

streamslice(U,V) assumes X, Y, and Z are determined by the expression

```[X,Y,Z] = meshgrid(1:n,1:m,1:p)
```

where [m,n,p] = size(U).

streamslice(...,density) modifies the automatic spacing of the streamlines. density must be greater than 0. The default value is 1; higher values produce more streamlines on each plane. For example, 2 produces approximately twice as many streamlines, while 0.5 produces approximately half as many.

streamslice(...,'arrowsmode') determines if direction arrows are present or not. arrowmode can be

• arrows — Draw direction arrows on the streamlines (default).

• noarrows — Do not draw direction arrows.

streamslice(...,'method') specifies the interpolation method to use. method can be

• linear — Linear interpolation (default)

• cubic — Cubic interpolation

• nearest — Nearest-neighbor interpolation

See interp3 for more information on interpolation methods.

streamslice(axes_handle,...) plots into the axes object with the handle axes_handle instead of into the current axes object (gca).

h = streamslice(...) returns a vector of handles to the line objects created.

[vertices arrowvertices] = streamslice(...) returns two cell arrays of vertices for drawing the streamlines and the arrows. You can pass these values to any of the streamline drawing functions (streamline, streamribbon, streamtube).

## Examples

expand all

### Plot Streamlines in Slice Plane

Load the wind data set. Draw a stream slice at z = 5.

```load wind

figure
streamslice(x,y,z,u,v,w,[],[],[5])
axis tight
```

## See Also

Was this topic helpful?