interpstreamspeed

Resamples stream line vertices so that their spacing is proportional to the local speed of the vector field.

Category: Graphics > 2-D and 3-D Plots

Syntax

verts = interpstreamspeed(X, Y, U, V, verts0)

Resamples the 2-D stream lines in the cell array verts0 over the field (U, V) on the grid (X, Y).

verts = interpstreamspeed(X, Y, Z, U, V, W, verts0)

The 3-D form.

verts = interpstreamspeed(___, sf)

Scales the step size by the factor sf, 1 by default.

Description

Walking along a stream line, the function takes steps whose length is the field speed at the current point times sf. Where the flow is fast the output vertices are far apart, and where it is slow they bunch up. The result is meant for streamparticles, so that animated particles move faster in fast regions.

Input arguments

X, Y, Z
Grid coordinates, as from meshgrid.
U, V, W
Components of the vector field on the grid.
verts0
Cell array in which each cell is an n-by-2 (or n-by-3) matrix of stream line vertices, as returned by stream2 or stream3.
sf
Scale factor for the distance between output vertices.

Output arguments

verts
Cell array with the resampled vertices of each line.

Example

Uniform field

[x, y] = meshgrid(1:5);
u = ones(5);
v = zeros(5);
out = interpstreamspeed(x, y, u, v, {[1 2; 5 2]});
out{1}
Output
ans = 4×2

     1     2
     2     2
     3     2
     4     2

See also

streamparticles stream2 stream3 streamline meshgrid