stream2
Computes 2-D streamline vertices of a vector field.
Category: Graphics > 2-D and 3-D Plots
Syntax
verts = stream2(X, Y, U, V, startx, starty)
Traces a streamline from each starting point.
verts = stream2(U, V, startx, starty)
Uses array indices as coordinates.
Description
The path follows the field by numerical integration, forward and backward from each starting point, and stops at the edge of the grid or where the field vanishes. The vertices can be passed to streamline to draw the curves, or used directly in computations.
Input arguments
X, Y- Grid coordinates, such as from
meshgrid. U, V- Vector components at the grid points.
startx, starty- Coordinates of the starting points.
Output arguments
verts- Cell array with one entry per starting point. Each entry is an N-by-2 matrix of x and y vertices.
Example
A path in a rotation field
[x, y] = meshgrid(-2:0.5:2);
u = -y;
v = x;
xy = stream2(x, y, u, v, 1, 0);
disp(class(xy))
disp(size(xy{1}, 2))
Output
cell
2