Main Content

stream3

Compute 3-D streamline data

Description

example

XYZ= stream3(X,Y,Z,U,V,W,startX,startY,startZ)returns streamline data as a 2-D matrix of vector fields. The inputsx,y, andz矢量数据的坐标,U,V, andZare vector data, andstartX,startY, andstartZare the starting positions of the streamlines.

XYZ= stream3(U,V,W,startX,startY,startZ)uses the default coordinate data forU,V, andW. The (x,y,z) location for each element inU,V, andWis based on the column, row, and page index, respectively.

example

XYZ= stream3(___,options)computes 3-D streamline data using the specified options, defined as a one- or two-element vector with the formstepor[step maxvert], wherestepis the step size for interpolating the vector data andmaxvertis the maximum number of vertices in a streamline. Use this argument with any of the input argument combinations from the previous syntaxes.

Examples

collapse all

Load thewinddata set which contains measurements of air current over regions of North America.

  • 3-D arraysx,y, andzrepresent the locations of air current measurements.

  • 3-D arraysu,v, andwrepresent 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 startingypositions ranging from 20 to 50 and startingzpositions 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)

Figure contains an axes object. The axes object contains 16 objects of type line.

Load thewinddata set, which contains measurements of air current over regions of North America.

  • 3-D arraysx,y, andzrepresent the locations of air current measurements.

  • 3-D arraysu,v, andwrepresent 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 startingypositions ranging from 20 to 50 and startingzpositions 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)

Figure contains an axes object. The axes object contains 16 objects of type line.

Load thewinddata set, which contains measurements of air current over regions of North America.

  • 3-D arraysx, andy, andz represent the locations of air current measurements.

  • 3-D arraysu, andv, andzrepresent 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 startingypositions ranging from 20 to 50 and startingzpositions 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)

Figure contains an axes object. The axes object contains 16 objects of type line.

Input Arguments

collapse all

x-axis coordinates of vector data, specified as a 3-D array. It must be monotonic, but does not need to be uniformly spaced.Xmust be the same size asY,Z,U,V, andW.

You can use themeshgridfunction to createX.

y-axis coordinates of vector data, specified as a 3-D array. It must be monotonic, but does not need to be uniformly spaced.Ymust be the same size asX,Z,U,V, andW.

You can use themeshgridfunction to createY.

z-axis coordinates of vector data, specified as a 3-D array. It must be monotonic, but does not need to be uniformly spaced.Zmust be the same size asX,Y,U,V, andW.

You can use themeshgridfunction to createZ.

x-components of vector data, specified as a 3-D array.Umust be the same size asX,Y,Z,V, andW.

y-components of vector data, specified as a 3-D array.Vmust be the same size asX,Y,Z,U, andW.

z-components of vector data, specified as a 3-D array.Wmust be the same size asX,Y,Z,U, andV.

x-axis streamline starting positions, specified as a vector or matrix.startXmust be a scalar or be the same size asstartYandstartZ.

y-axis streamline starting positions, specified as a vector or matrix.startYmust be a scalar or be the same size asstartXandstartZ.

z-axis streamline starting positions, specified as a vector or matrix.startZmust be a scalar or be the same size asstartXandstartY.

Streamline options, specified as a one- or two-element vector with one of the following forms:

  • step

  • [step maxvert]

stepis the step size used to adjust the streamline resolution and determine the vertex locations for which streamline velocity is interpolated.maxvertis 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

Version History

Introduced before R2006a