stream3
Compute 3-D streamline data
Syntax
Description
computes 3-D streamline data using the specified options, defined as a one- or two-element vector with the formXYZ
= stream3(___,options
)step
or[step maxvert]
, wherestep
is the step size for interpolating the vector data andmaxvert
is the maximum number of vertices in a streamline. Use this argument with any of the input argument combinations from the previous syntaxes.
Examples
Compute 3-D Streamlines
Load thewind
data set which contains measurements of air current over regions of North America.
3-D arrays
x
,y
, andz
represent the locations of air current measurements.3-D arrays
u
,v
, andw
represent the velocity of the air current in 3-D vector fields.
Define the starting position of 16 hypothetical particles. In this case, the particles all start atx
= 80 and have startingy
positions ranging from 20 to 50 and startingz
positions ranging from 0 to 15.
loadwind[startX,startY,startZ] = meshgrid(80,20:10:50,0:5:15);
Compute the 3-D streamline vertex data for a hypothetical particle placed into the air current at the collection of starting positions instartX
,startY
, andstartZ
.
verts = stream3(x,y,z,u,v,w,startX,startY,startZ);
Visualize the 3-D volume of vector fields withstreamline
.
streamline(verts) view(3)
为三维流线指定步长
Load thewind
data set, which contains measurements of air current over regions of North America.
3-D arrays
x
,y
, andz
represent the locations of air current measurements.3-D arrays
u
,v
, andw
represent the velocity of the air current in 3-D vector fields.
Define the starting position of 16 hypothetical particles. In this case, the particles all start atx
= 80 and have startingy
positions ranging from 20 to 50 and startingz
positions ranging from 0 to 15.
loadwind[startX,startY,startZ] = meshgrid(80,20:10:50,0:5:15);
Decrease the streamline resolution by increasing the step size from the default of 0.1 to 3.
step = 3;
Compute the 3-D streamline vertex data for a hypothetical particle placed into the air current at the collection of starting positions instartX
,startY
, andstartZ
.
verts = stream3(x,y,z,u,v,w,startX,startY,startZ,step);
Visualize the 3-D volume of vector fields withstreamline
. The larger step size results in a lower resolution streamline.
streamline(verts) view(3)
Specify Maximum Number of Vertices for 3-D Streamlines
Load thewind
data set, which contains measurements of air current over regions of North America.
3-D arrays
x
, andy, and
z represent the locations of air current measurements.3-D arrays
u
, andv
, andz
represent the velocity of the air current in 3-D vector fields.
Define the starting position of 16 hypothetical particles. In this case, the particles all start atx
= 80 and have startingy
positions ranging from 20 to 50 and startingz
positions ranging from 0 to 15.
loadwind[startX,startY,startZ] = meshgrid(80,20:10:50,0:5:15);
Increase the streamline resolution by decreasing the step size from the default of 0.1 to 0.01.
step = 0.01;
Set the maximum number of vertices so that computation ends after the first 1,000 vertices are calculated.
maxvert = 1000;
Compute the 3-D streamline vertex data for a hypothetical particle placed into the air current at the collection of starting positions instartX
,startY
, andstartZ
.
verts = stream3(x,y,z,u,v,w,startX,startY,startZ,[step maxvert]);
Visualize the 3-D volume of vector fields withstreamline
. Show the full range of data values by setting the axis limits. The streamlines end after 1,000 vertices are calculated, so the streamlines stop before showing the full range of data.
streamline(verts) xlim([75 135]) ylim([15 65]) zlim([0 15]) view(3)
Input Arguments
X
—x-axis coordinates of vector data
3-D array
x-axis coordinates of vector data, specified as a 3-D array. It must be monotonic, but does not need to be uniformly spaced.X
must be the same size asY
,Z
,U
,V
, andW
.
You can use themeshgrid
function to createX
.
Y
—y-axis coordinates of vector data
3-D array
y-axis coordinates of vector data, specified as a 3-D array. It must be monotonic, but does not need to be uniformly spaced.Y
must be the same size asX
,Z
,U
,V
, andW
.
You can use themeshgrid
function to createY
.
Z
—z-axis coordinates of vector data
3-D array
z-axis coordinates of vector data, specified as a 3-D array. It must be monotonic, but does not need to be uniformly spaced.Z
must be the same size asX
,Y
,U
,V
, andW
.
You can use themeshgrid
function to createZ
.
U
—x-components of vector data
3-D array
x-components of vector data, specified as a 3-D array.U
must be the same size asX
,Y
,Z
,V
, andW
.
V
—y-components of vector data
3-D array
y-components of vector data, specified as a 3-D array.V
must be the same size asX
,Y
,Z
,U
, andW
.
W
—z-components of vector data
3-D array
z-components of vector data, specified as a 3-D array.W
must be the same size asX
,Y
,Z
,U
, andV
.
startX
—x-axis streamline starting positions
scalar|vector|matrix
x-axis streamline starting positions, specified as a vector or matrix.startX
must be a scalar or be the same size asstartY
andstartZ
.
startY
—y-axis streamline starting positions
scalar|vector|matrix
y-axis streamline starting positions, specified as a vector or matrix.startY
must be a scalar or be the same size asstartX
andstartZ
.
startZ
—z-axis streamline starting positions
scalar|vector|matrix
z-axis streamline starting positions, specified as a vector or matrix.startZ
must be a scalar or be the same size asstartX
andstartY
.
options
—Streamline options
[0.1 10000](default) |one-element vector|two-element vector
Streamline options, specified as a one- or two-element vector with one of the following forms:
step
[step maxvert]
step
is the step size used to adjust the streamline resolution and determine the vertex locations for which streamline velocity is interpolated.maxvert
is the maximum number of vertices calculated for a streamline before computation is complete.
The default step-size is0.1
, and the default maximum number of vertices in a streamline is10,000
.
Extended Capabilities
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Usage notes and limitations:
This function accepts GPU arrays, but does not run on a GPU.
For more information, seeRun MATLAB Functions on a GPU(Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
Usage notes and limitations:
This function operates on distributed arrays, but executes in the client MATLAB®.
For more information, seeRun MATLAB Functions with Distributed Arrays(Parallel Computing Toolbox).
Version History
开放的例子
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)