Plot stream particles
h = streamparticles(...)
draws stream particles of a vector field. Stream particles are usually
represented by markers and can show the position and velocity of a
vertices is a cell array of 2-D or
3-D vertices (as if produced by
n to determine how many stream particles to
ParticleAlignment property controls how
ParticleAlignment is set to
n is greater than
n particles are drawn evenly spaced
over the streamline vertices.
n is less than or equal to
interpreted as a fraction of the original stream vertices; for example,
0.2, approximately 20%
of the vertices are used.
n determines the upper bound for the number
of particles drawn. The actual number of particles can deviate from
as much as a factor of 2.
the number of particles on the streamline having the most vertices
and sets the spacing on the other streamlines to this value. The default
n = 1.
controls the stream particles using named properties and specified
values. Any unspecified properties have default values. MATLAB® ignores
the case of property names.
streamparticles(ax,...) creates the stream
particles in the axes specified by
ax instead of
in the current axes (
gca). The option
precede any of the input argument combinations in the previous syntaxes.
Animate — Stream particle motion [nonnegative
The number of times to animate the stream particles.
The default is
0, which does not animate.
until you enter Ctrl+C.
FrameRate — Animation frames per second
This property specifies the number of frames per
second for the animation.
Inf, the default, draws
the animation as fast as possible. Note that the speed of the animation
might be limited by the speed of the computer. In such cases, the
FrameRate cannot necessarily be achieved.
ParticleAlignment — Align particles
with streamlines [
Set this property to
on to draw particles
at the beginning of each streamline. This property controls how
n (number of stream particles).
Stream particles are primitive line objects. In addition to
stream particle properties, you can specify any line property, such
the following line properties when called.
Value Set by streamparticles
You can override any of these properties by specifying a property
name and value as arguments to
For example, this statement uses RGB values to set the
streamparticles(vertices,'MarkerFaceColor',[.5 .5 .5])
uses the line object identified by
draw the stream particles.
h = streamparticles(...)
returns a vector of handles to the primitive line objects it creates.
For a list of properties, see Primitive
This example uses streamlines in the
z = 5 plane to animate the flow along these lines with stream particles.
load wind figure daspect([1,1,1]); view(2) [verts,averts] = streamslice(x,y,z,u,v,w,,,); sl = streamline([verts averts]); axis tight manual off; ax = gca; ax.Position = [0,0,1,1]; set(sl,'Visible','off') iverts = interpstreamspeed(x,y,z,u,v,w,verts,.05); zlim([4.9,5.1]); streamparticles(iverts, 200, ... 'Animate',15,'FrameRate',40, ... 'MarkerSize',10,'MarkerFaceColor',[0 .5 0])