stream2
Compute 2-D streamline vertices from vector field data.
📝Syntax
vertices = stream2(U, V, startx, starty)
vertices = stream2(X, Y, U, V, startx, starty)
vertices = stream2(..., options)
📄Description

stream2 follows a 2-D vector field from each start point and returns the vertices it passed through. Nothing is drawn: hand the result to streamline to see it.

The result is a cell array with one entry per start point, each an N-by-2 array of [x, y] coordinates whose first row is the start point itself. A start point outside the field gives an empty entry; a start point the field does not move keeps its single vertex.

Without X and Y the field is indexed from 1, as meshgrid(1:size(U, 2), 1:size(U, 1)) would give it.

The optional options input is [stepsize] or [stepsize, maxvert]. stepsize is counted in grid cells and defaults to 0.1. maxvert is the largest number of vertices to produce, the start point counted in, and defaults to 500.

💡Examples
Trace two streamlines of a rotating field.
[x, y] = meshgrid(-2:0.25:2, -2:0.25:2);
vertices = stream2(x, y, -y, x, [1 1.5], [0 0]);
streamline(vertices);
Example illustration
🔗See Also
stream3streamlinequiver
Edit this page on GitHub