Documentation

streamline

Plot streamlines from 2-D or 3-D vector data Syntax

streamline(X,Y,Z,U,V,W,startx,starty,startz)
streamline(U,V,W,startx,starty,startz)
streamline(XYZ)
streamline(X,Y,U,V,startx,starty)
streamline(U,V,startx,starty)
streamline(XY)
streamline(...,options)
streamline(axes_handle,...)
h = streamline(...)

Description

streamline(X,Y,Z,U,V,W,startx,starty,startz) draws streamlines from 3-D vector data U, V, W.

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.

startx, starty, startz define the starting positions of the streamlines.

streamline(U,V,W,startx,starty,startz) assumes the arrays X, Y, and Z are defined as [X,Y,Z] = meshgrid(1:N,1:M,1:P), where [M,N,P] = size(U).

streamline(XYZ) assumes XYZ is a precomputed cell array of vertex arrays (as produced by stream3).

streamline(X,Y,U,V,startx,starty) draws streamlines from 2-D vector 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.

startx and starty define the starting positions of the streamlines. The output argument h contains a vector of line handles, one handle for each streamline.

streamline(U,V,startx,starty) assumes the arrays X and Y are defined as [X,Y] = meshgrid(1:N,1:M), where [M,N] = size(U).

streamline(XY) assumes XY is a precomputed cell array of vertex arrays (as produced by stream2).

streamline(...,options) specifies the options used when creating the streamlines. Define options as a one- or two-element vector containing the step size or the step size and the maximum number of vertices in a streamline:

[stepsize]

or

[stepsize, max_number_vertices]

If you do not specify values, MATLAB® uses the default:

• Step size = 0.1 (one tenth of a cell)

• Maximum number of vertices = 1000

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

h = streamline(...) returns a vector of line handles, one handle for each streamline.

Examples

collapse all

Define arrays x, y, u, and v.

[x,y] = meshgrid(0:0.1:1,0:0.1:1);
u = x;
v = -y;

Create a quiver plot of the data. Plot streamlines that start at different points along the line $y=1$.

figure
quiver(x,y,u,v)

startx = 0.1:0.1:1;
starty = ones(size(startx));
streamline(x,y,u,v,startx,starty) 