Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
25
Добавлен:
09.02.2015
Размер:
500.22 Кб
Скачать

Interpreted.

Also, any line property/value pairs such as 'erasemode' or

'marker' can be used. The following is the default list of

line properties set by STREAMPARTICLES. These can be overridden

by passing in property/value pairs.

Property Value

-------- -----

'EraseMode' 'xor'

'LineStyle' 'none'

'Marker' 'o'

'MarkerEdgeColor' 'none'

'MarkerFaceColor' 'red'

STREAMPARTICLES(H,...) uses the LINE object H to draw the

stream particles.

STREAMPARTICLES(AX,...) plots into AX instead of GCA. This option is

ignored if you specify H as well.

H = STREAMPARTICLES(...) returns a vector of handles to LINE

objects.

Example 1:

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])

set(gca, 'drawmode', 'fast')

camproj perspective; box on

camva(44); camlookat; camdolly(0,0,.4, 'f');

h = line;

streamparticles(h, iverts, 35, 'animate', 10, ...

'ParticleAlignment', 'on');

Example 2:

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, 'linewidth', 2, 'color', 'r', 'vis', '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', 'k')

h = line;

streamparticles(h, iverts, 200, ...

'animate', 100, 'framerate',40, ...

'markers', 10, 'markerf', 'y');

See also interpstreamspeed, streamline, stream3, stream2.

Reference page in Help browser

doc streamparticles

<interpstreamspeed> - Interpolate streamline vertices from speed.

INTERPSTREAMSPEED Interpolate streamline vertices from speed.

INTERPSTREAMSPEED(X,Y,Z,U,V,W,VERTICES) interpolates streamline

vertices based on the speed of the vector data U,V,W. The

arrays X,Y,Z define the coordinates for U,V,W and must be

monotonic and 3D plaid (as if produced by MESHGRID).

INTERPSTREAMSPEED(U,V,W,VERTICES) assumes

[X Y Z] = meshgrid(1:N, 1:M, 1:P) where [M,N,P]=SIZE(U).

INTERPSTREAMSPEED(X,Y,Z,SPEED,VERTICES) uses the 3D array SPEED

for the speed of the vector field.

INTERPSTREAMSPEED(SPEED,VERTICES) assumes

[X Y Z] = meshgrid(1:N, 1:M, 1:P) where [M,N,P]=SIZE(SPEED).

INTERPSTREAMSPEED(X,Y,U,V,VERTICES) interpolates streamline

vertices based on the speed of the vector data U,V. The arrays

X,Y define the coordinates for U,V and must be monotonic and 2D

plaid (as if produced by MESHGRID).

INTERPSTREAMSPEED(U,V,VERTICES) assumes

[X Y] = meshgrid(1:N, 1:M) where [M,N]=SIZE(U).

INTERPSTREAMSPEED(X,Y,SPEED,VERTICES) uses the 2D array SPEED

for the speed of the vector field.

INTERPSTREAMSPEED(SPEED,VERTICES) assumes

[X Y] = meshgrid(1:N, 1:M) where [M,N]=SIZE(SPEED).

INTERPSTREAMSPEED(...SF) uses SF to scale the speed of the

vector data and therefore controls the number of interpolated

vertices. For example, if SF were 3, one third of the vertices

would be created.

VERTSOUT = INTERPSTREAMSPEED(...) returns the cell array of

vertex arrays.

Example 1:

load wind

[sx sy sz] = meshgrid(80, 20:1:55, 5);

verts = stream3(x,y,z,u,v,w,sx,sy,sz);

iverts = interpstreamspeed(x,y,z,u,v,w,verts,.2);

sl=streamline(iverts);

set(sl, 'marker', '.');

axis tight; view(2); daspect([1 1 1])

Example 2:

z = membrane(6,30);

[u v] = gradient(z);

[verts averts] = streamslice(u,v);

iverts = interpstreamspeed(u,v,verts,15);

sl=streamline(iverts);

set(sl, 'marker', '.');

hold on; surf(0*z-1,z); shading interp

axis tight; view(2); daspect([1 1 1])

See also STEAMPARTICLES, streamslice, streamline, stream3,

stream2.

Reference page in Help browser

doc interpstreamspeed

<subvolume> - Extract subset of volume dataset.

SUBVOLUME Extract subset of volume dataset.

[NX, NY, NZ, NV] = SUBVOLUME(X,Y,Z,V,LIMITS) extracts a subset of

volume dataset V using specified axis-aligned LIMITS. LIMITS =

[xmin xmax ymin ymax zmin zmax] (Any nans in the limits indicate

that the volume should not be cropped along that axis.) Arrays X,

Y and Z specify the points at which the data V is given. The

subvolume is returned in NV and the coordinates of the subvolume

are given in NX, NY and NZ.

[NX, NY, NZ, NV] = SUBVOLUME(V,LIMITS) assumes

[X Y Z] = meshgrid(1:N, 1:M, 1:P) where [M,N,P]=SIZE(V).

[NX, NY, NZ, NU, NV, NW] = SUBVOLUME(X,Y,Z,U,V,W,LIMITS)

extracts subset of vector dataset U,V,W.

[NX, NY, NZ, NU, NV, NW] = SUBVOLUME(U,V,W,LIMITS) assumes

[X Y Z] = meshgrid(1:N, 1:M, 1:P) where [M,N,P]=SIZE(U).

NV = SUBVOLUME(...) or [NU, NV, NW] = SUBVOLUME(...) returns

the subvolume only.

Example 1:

load mri

D = squeeze(D);

[x y z D] = subvolume(D, [60 80 nan 80 nan nan]);

p = patch(isosurface(x,y,z,D, 5), 'FaceColor', 'red', 'EdgeColor', 'none');

p2 = patch(isocaps(x,y,z,D, 5), 'FaceColor', 'interp', 'EdgeColor', 'none');

view(3); axis tight; daspect([1 1 .4])

colormap(gray(100))

camlight; lighting gouraud

isonormals(x,y,z,D,p);

Example 2:

load wind

[x y z u v w] = subvolume(x,y,z,u,v,w,[105 120 nan 30 2 6]);

streamslice(x,y,z,u,v,w,[],[],[3 4 5], .4);

daspect([1 1 .125])

h = streamtube(x,y,z,u,v,w,110,22,5.5);

set(h, 'FaceColor', 'red', 'EdgeColor', 'none')

axis tight

view(3)

camlight; lighting gouraud

See also isosurface, isocaps, isonormals, smooth3, reducevolume,

reducepatch.

Reference page in Help browser

doc subvolume

<reducevolume> - Reduce volume dataset.

REDUCEVOLUME Reduce volume dataset.

[NX, NY, NZ, NV] = REDUCEVOLUME(X,Y,Z,V,[Rx Ry Rz]) reduces the number

of elements in the volume by only keeping every Rx element in the x

direction, every Ry element in the y direction, and every Rz element

in the z direction. If a scalar R is used to indicate the amount or

reduction instead of a 3 element vector, the reduction is assumed to

be [R R R]. Arrays X, Y and Z specify the points at which the data V

is given. The reduced volume is returned in NV and the coordinates of

the reduced volume are given in NX, NY, and NZ.

[NX, NY, NZ, NV] = REDUCEVOLUME(V,[Rx Ry Rz]) assumes

[X Y Z] = meshgrid(1:N, 1:M, 1:P) where [M,N,P]=SIZE(V).

NV = REDUCEVOLUME(...) returns the reduced volume only.

Example:

load mri

D = squeeze(D);

[x y z D] = reducevolume(D, [4 4 1]);

D = smooth3(D);

p = patch(isosurface(x,y,z,D, 5,'verbose'), ...

'FaceColor', 'red', 'EdgeColor', 'none');

p2 = patch(isocaps(x,y,z,D, 5), 'FaceColor', 'interp', 'EdgeColor', 'none');

view(3); axis tight; daspect([1 1 .4])

colormap(gray(100))

camlight; lighting gouraud

isonormals(x,y,z,D,p);

See also isosurface, isocaps, isonormals, smooth3, subvolume,

reducepatch.

Reference page in Help browser

doc reducevolume

<volumebounds> - Returns x,y,z and color limits for volume data.

VOLUMEBOUNDS Returns x,y,z and color limits for volume data.

LIMS = VOLUMEBOUNDS(X,Y,Z,V) returns the x,y,z and color limits

of the current axes for scalar data. LIMS is returned as a

vector: [xmin xmax ymin ymax zmin zmax cmin cmax]. This vector

can be passed to the AXIS command.

LIMS = VOLUMEBOUNDS(X,Y,Z,U,V,W) returns the x,y,z limits of

the current axes for vector data. LIMS is returned as a

vector: [xmin xmax ymin ymax zmin zmax].

VOLUMEBOUNDS(V) or VOLUMEBOUNDS(U,V,W) assumes

[X Y Z] = meshgrid(1:N, 1:M, 1:P) where [M,N,P]=SIZE(V).

Example:

[x y z v] = flow;

p = patch(isosurface(x, y, z, v, -3));

isonormals(x,y,z,v, p)

daspect([1 1 1])

isocolors(x,y,z,flipdim(v,2),p)

shading interp

axis(volumebounds(x,y,z,v))

view(3)

camlight

lighting phong

See also isosurface, streamslice.

Reference page in Help browser

doc volumebounds

<smooth3> - Smooth 3D data.

SMOOTH3 Smooth 3D data.

W = SMOOTH3(V) smoothes input data V. The smoothed data is returned

in W.

W = SMOOTH3(V, METHOD) METHOD can be either of the filters 'gaussian'

or 'box' (default) and determines the convolution kernel.

W = SMOOTH3(V, METHOD, SIZE) sets the size of the convolution kernel

(default is [3 3 3]). If SIZE is a scalar, the size is interpreted

as [SIZE SIZE SIZE].

W = SMOOTH3(V, METHOD, SIZE, ARG) sets an attribute of the

convolution kernel. When METHOD is 'gaussian', ARG is the standard

deviation (default is .65).

Example:

data = rand(10,10,10);

data = smooth3(data,'box',5);

p = patch(isosurface(data,.5), ...

'FaceColor', 'blue', 'EdgeColor', 'none');

p2 = patch(isocaps(data,.5), ...

'FaceColor', 'interp', 'EdgeColor', 'none');

isonormals(data,p)

view(3); axis vis3d tight

camlight; lighting phong

See also isosurface, isocaps, isonormals, subvolume, reducevolume,

reducepatch.

Reference page in Help browser

doc smooth3

<reducepatch> - Reduce number of patch faces.

REDUCEPATCH Reduce number of patch faces.

REDUCEPATCH(P, R) reduces the number of faces in patch P while trying

to preserve the overall shape of the patch. If R is less than or

equal to 1, R is interpreted as a fraction of the original faces; for

example, if R is 0.2, 20% of the faces will be kept. If R is greater

than 1, then R is the target number of faces. For example, if R were

400, then the number of faces would be reduced until there were 400

faces remaining. If the patch contains non-shared vertices, shared

vertices are computed before reduction. If the faces of the patch are

not triangles, the faces are triangulated before reduction. The faces

returned are always triangles.

NFV = REDUCEPATCH(P, R) returns the reduced set of faces and vertices

but does not set the Faces and Vertices properties of patch P. The

struct NFV contains the faces and vertices after reduction.

NFV = REDUCEPATCH(FV, R) uses faces and vertices from struct FV.

REDUCEPATCH(P) or NFV = REDUCEPATCH(FV) assumes a reduction of .5.

REDUCEPATCH(...,'fast') assumes the vertices are unique and

does not compute shared vertices.

REDUCEPATCH(...,'verbose') prints progress messages to the

command window as the computation progresses.

NFV = REDUCEPATCH(F, V, R) uses faces and vertices in arrays F and V.

[NF, NV] = REDUCEPATCH(...) returns the faces and vertices in two

arrays instead of a struct.

NOTE: The number of output triangles might not be exactly as specified

by the reduction value, especially if the input faces were not

triangles.

Example:

[x y z v] = flow;

fv = isosurface(x, y, z, v, -3);

subplot(1,2,1)

p = patch(fv);

set(p, 'facecolor', [.5 .5 .5], 'EdgeColor', 'black');

daspect([1 1 1]); view(3); axis tight

title([num2str(length(get(p, 'faces'))) ' Faces'])

subplot(1,2,2)

p = patch(fv);

set(p, 'facecolor', [.5 .5 .5], 'EdgeColor', 'black');

daspect([1 1 1]); view(3); axis tight

reducepatch(p, .15) % keep 15 percent of the faces

title([num2str(length(get(p, 'faces'))) ' Faces'])

See also isosurface, isocaps, isonormals, smooth3, subvolume,

reducevolume.

Reference page in Help browser

doc reducepatch

<shrinkfaces> - Reduce size of patch faces.

SHRINKFACES Reduce size of patch faces.

SHRINKFACES(P, SF) shrinks the area of the faces in patch P to shrink

factor SF. If SF is 0.6, each face is shrunk to 60% of its original

area. If the patch contains shared vertices, non-shared vertices are

created before reduction.

NFV = SHRINKFACES(P, SF) returns the faces and vertices but does not

set the Faces and Vertices properties of patch P. The struct NFV

contains the new faces and vertices.

NFV = SHRINKFACES(FV, SF) uses faces and vertices from struct FV.

SHRINKFACES(P) or SHRINKFACES(FV) assumes a shrink factor of .3.

NFV = SHRINKFACES(F, V, SF) uses faces and vertices in arrays F and V.

[NF, NV] = SHRINKFACES(...) returns the faces and vertices in two

arrays instead of a struct.

Example:

[x y z v] = flow;

[x y z v] = reducevolume(x,y,z,v, 2);

fv = isosurface(x, y, z, v, -3);

subplot(1,2,1)

p = patch(fv);

set(p, 'facecolor', [.5 .5 .5], 'EdgeColor', 'black');

daspect([1 1 1]); view(3); axis tight

title('Original')

subplot(1,2,2)

p = patch(shrinkfaces(fv, .2)); % shrink faces to 20% of original

set(p, 'facecolor', [.5 .5 .5], 'EdgeColor', 'black');

daspect([1 1 1]); view(3); axis tight

title('After Shrinking')

See also isosurface, isonormals, isocaps, smooth3, subvolume,

reducevolume, reducepatch.

Reference page in Help browser

doc shrinkfaces

Images display and file I/O

<image> - Display image.

IMAGE Display image.

IMAGE(C) displays matrix C as an image. Each element of C

specifies the color of a rectilinear patch in the image. C can be

a matrix of dimension MxN or MxNx3, and can contain double, uint8,

or uint16 data.

When C is a 2-dimensional MxN matrix, the elements of C are used

as indices into the current COLORMAP to determine the color. The

value of the image object's CDataMapping property determines the

method used to select a colormap entry. For 'direct' CDataMapping

(the default), values in C are treated as colormap indices

(1-based if double, 0-based if uint8 or uint16). For 'scaled'

CDataMapping, values in C are first scaled according to the axes

CLim and then the result is treated as a colormap index. When C is

a 3-dimensional MxNx3 matrix, the elements in C(:,:,1) are

interpreted as red intensities, in C(:,:,2) as green intensities,

and in C(:,:,3) as blue intensities, and the CDataMapping property

of image is ignored. For matrices containing doubles, color

intensities are on the range [0.0, 1.0]. For uint8 and uint16

matrices, color intensities are on the range [0, 255].

IMAGE(C) places the center of element C(1,1) at (1,1) in the axes,

and the center of element (M,N) at (M,N) in the axes, and draws

each rectilinear patch as 1 unit in width and height. As a

result, the outer extent of the image occupies [0.5 N+0.5 0.5 M+0.5]

of the axes, and each pixel center of the image lies at integer

coordinates ranging between 1 and M or N.

IMAGE(X,Y,C), where X and Y are vectors, specifies the locations

of the pixel centers of C(1,1) and C(M,N). Element C(1,1) is

centered over (X(1), Y(1)), element C(M,N) is centered over

(X(end), Y(end)), and the pixel centers of the remaining elements

of C are spread out evenly between those two points, so that the

rectilinear patches are all of equal width and height.

IMAGE returns a handle to an IMAGE object.

C or the X,Y,C triple can be followed by property/value

pairs to specify additional properties of the image.

C or the X,Y,C triple can be omitted entirely, and all

properties specified using property/value pairs.

IMAGE(...,'Parent',AX) specifies AX as the parent axes for the

image object during creation.

When called with C or X,Y,C, IMAGE sets the axes limits to tightly

enclose the image, sets the axes YDir property to 'reverse', and

sets the axes View property to [0 90].

The image object will not render at axes View angles other than

[0 90]. To get a similar effect to rotating an image, use SURF

with texture mapping or PCOLOR.

Execute GET(H), where H is an image handle, to see a list of image

object properties and their current values. Execute SET(H) to see a

list of image object properties and legal property values.

See also imagesc, colormap, pcolor, surf, imread, imwrite.

Reference page in Help browser

doc image

<imagesc> - Scale data and display as image.

IMAGESC Scale data and display as image.

IMAGESC(...) is the same as IMAGE(...) except the data is scaled

to use the full colormap.

IMAGESC(...,CLIM) where CLIM = [CLOW CHIGH] can specify the

scaling.

See also image, colorbar, imread, imwrite.

Reference page in Help browser

doc imagesc

<colormap> - Color look-up table.

COLORMAP Color look-up table.

COLORMAP(MAP) sets the current figure's colormap to MAP.

COLORMAP('default') sets the current figure's colormap to

the root's default, whose setting is JET.

MAP = COLORMAP retrieves the current colormap. The values

are in the range from 0 to 1.

COLORMAP(AX,...) uses the figure corresponding to axes AX

instead of the current figure.

A color map matrix may have any number of rows, but it must have

exactly 3 columns. Each row is interpreted as a color, with the

first element specifying the intensity of red light, the second

green, and the third blue. Color intensity can be specified on the

interval 0.0 to 1.0.

For example, [0 0 0] is black, [1 1 1] is white,

[1 0 0] is pure red, [.5 .5 .5] is gray, and

[127/255 1 212/255] is aquamarine.

Graphics objects that use pseudocolor -- SURFACE and PATCH objects,

which are created by the functions MESH, SURF, and PCOLOR -- map

a color matrix, C, whose values are in the range [Cmin, Cmax],

to an array of indices, k, in the range [1, m].

The values of Cmin and Cmax are either min(min(C)) and max(max(C)),

or are specified by CAXIS. The mapping is linear, with Cmin

mapping to index 1 and Cmax mapping to index m. The indices are

then used with the colormap to determine the color associated

with each matrix element. See CAXIS for details.

Type HELP GRAPH3D to see a number of useful colormaps.

COLORMAP is a function that sets the Colormap property of a figure.

See also hsv, caxis, spinmap, brighten, rgbplot, figure, colormapeditor.

Reference page in Help browser

doc colormap

<gray> - Linear gray-scale color map.

GRAY Linear gray-scale color map

GRAY(M) returns an M-by-3 matrix containing a gray-scale colormap.

GRAY, by itself, is the same length as the current figure's

colormap. If no figure exists, MATLAB creates one.

For example, to reset the colormap of the current figure:

colormap(gray)

See also hsv, hot, cool, bone, copper, pink, flag,

colormap, rgbplot.

<contrast> - Gray scale color map to enhance image contrast.

CONTRAST Gray scale color map to enhance image contrast.

CMAP = CONTRAST(X,M) returns a gray contrast enhancing color,

map that is a M-by-3 matrix with 3 identical columns, so that

IMAGE(X)

COLORMAP(CMAP)

has a roughly equi-distributed gray scale histogram.

If M is omitted, the current colormap length is used.

CONTRAST works best when the image colors are ordered by

intensity.

Reference page in Help browser

doc contrast

<brighten> - Brighten or darken color map.

BRIGHTEN Brighten or darken color map.

BRIGHTEN(BETA) replaces the current color map with a brighter

or darker map involving essentially the same colors. The map is

brighter if 0 < BETA <= 1 and darker if -1 <= BETA < 0.

BRIGHTEN(BETA), followed by BRIGHTEN(-BETA) restores the

original map.

MAP = BRIGHTEN(BETA) returns a brighter or darker version of the

color map currently being used without changing the display.

NEWMAP = BRIGHTEN(MAP,BETA) returns a brighter or darker version

of the specified color map without changing the display.

BRIGHTEN(FIG,BETA) brightens all the objects in the figure FIG.

Reference page in Help browser

doc brighten

<colorbar> - Display color bar (color scale).

COLORBAR Display color bar (color scale)

COLORBAR appends a colorbar to the current axes in the default (right)

location

COLORBAR('peer',AX) creates a colorbar associated with axes AX

Соседние файлы в папке Библиотеки Matlab