Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

streamparticles - Plot stream particles

GUI Alternatives

To graph selected variables, use the Plot Selector in the Workspace Browser, or use the Figure Palette Plot Catalog. Manipulate graphs in plot edit mode with the Property Editor. For details, see Plotting Tools — Interactive Plotting in the MATLAB Graphics documentation and Creating Graphics from the Workspace Browser in the MATLAB Desktop Tools documentation.

Syntax

streamparticles(vertices)
streamparticles(vertices,n)
streamparticles(...,'PropertyName',PropertyValue,...)
streamparticles(line_handle,...)
h = streamparticles(...)

Description

streamparticles(vertices) draws stream particles of a vector field. Stream particles are usually represented by markers and can show the position and velocity of a streamline. vertices is a cell array of 2-D or 3-D vertices (as if produced by stream2 or stream3).

streamparticles(vertices,n) uses n to determine how many stream particles to draw. The ParticleAlignment property controls how n is interpreted.

streamparticles(...,'PropertyName',PropertyValue,...) controls the stream particles using named properties and specified values. Any unspecified properties have default values. MATLAB ignores the case of property names.

Stream Particle Properties

Animate — Stream particle motion [nonnegative integer]

The number of times to animate the stream particles. The default is 0, which does not animate. Inf animates until you enter Ctrl+C.

FrameRate — Animation frames per second [nonnegative integer]

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 value of FrameRate cannot necessarily be achieved.

ParticleAlignment — Align particles with streamlines [ on | {off} ]

Set this property to on to draw particles at the beginning of each streamline. This property controls how streamparticles interprets the argument n (number of stream particles).

Stream particles are line objects. In addition to stream particle properties, you can specify any line object property, such as Marker and EraseMode. streamparticles sets the following line properties when called.

Line Property

Value Set by streamparticles

EraseModexor
LineStylenone
Markero
MarkerEdgeColornone
MarkerFaceColorred

You can override any of these properties by specifying a property name and value as arguments to streamparticles. For example, this statement uses RGB values to set the MarkerFaceColor to medium gray:

streamparticles(vertices,'MarkerFaceColor',[.5 .5 .5])

streamparticles(line_handle,...) uses the line object identified by line_handle to draw the stream particles.

h = streamparticles(...) returns a vector of handles to the line objects it creates.

Examples

This example combines streamlines with stream particle animation. The interpstreamspeed function determines the vertices along the streamlines where stream particles will be drawn during the animation, thereby controlling the speed of the animation. Setting the axes DrawMode property to fast provides faster rendering.

load wind
[sx sy sz] = meshgrid(80,20:1:55,5);
verts = stream3(x,y,z,u,v,w,sx,sy,sz);
sl = streamline(verts);
iverts = interpstreamspeed(x,y,z,u,v,w,verts,.025);
axis tight; view(30,30); daspect([1 1 .125])
camproj perspective; camva(8)
set(gca,'DrawMode','fast')
box on
streamparticles(iverts,35,'animate',10,'ParticleAlignment','on')

The following picture is a static view of the animation.

This example uses the streamlines in the z = 5 plane to animate the flow along these lines with streamparticles.

load wind
daspect([1 1 1]); view(2)
[verts averts] = streamslice(x,y,z,u,v,w,[],[],[5]); 
sl = streamline([verts averts]);
axis tight off;
set(sl,'Visible','off')
iverts = interpstreamspeed(x,y,z,u,v,w,verts,.05);
set(gca,'DrawMode','fast','Position',[0 0 1 1],'ZLim',[4.9 5.1])
set(gcf,'Color','black')
streamparticles(iverts, 200, ...
    'Animate',100,'FrameRate',40, ...
    'MarkerSize',10,'MarkerFaceColor','yellow')

See Also

interpstreamspeed, stream3, streamline

Volume Visualization for related functions

Creating Stream Particle Animations for more details

Specifying Starting Points for Stream Plots for related information

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS