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

matlab\specgraph – Специализированные графики

Specialized 2-D graphs

<area> - Filled area plot.

AREA Filled area plot.

AREA(X,Y) produces a stacked area plot suitable for showing the

contributions of various components to a whole.

For vector X and Y, AREA(X,Y) is the same as PLOT(X,Y) except that

the area between 0 and Y is filled. When Y is a matrix, AREA(X,Y)

plots the columns of Y as filled areas. For each X, the net

result is the sum of corresponding values from the columns of Y.

AREA(Y) uses the default value of X=1:SIZE(Y,1).

AREA(X,Y,LEVEL) or AREA(Y,LEVEL) specifies the base level

for the area plot to be at the value y=LEVEL. The default

value is LEVEL=0.

AREA(...,'Prop1',VALUE1,'Prop2',VALUE2,...) sets the specified

properties of the underlying areaseries objects.

AREA(AX,...) plots into axes with handle AX. Use GCA to get the

handle to the current axes or to create one if none exist.

H = AREA(...) returns a vector of handles to areaseries objects.

See also plot, bar.

Reference page in Help browser

doc area

<bar> - Bar graph.

BAR Bar graph.

BAR(X,Y) draws the columns of the M-by-N matrix Y as M groups of N

vertical bars. The vector X must not have duplicate values.

BAR(Y) uses the default value of X=1:M. For vector inputs, BAR(X,Y)

or BAR(Y) draws LENGTH(Y) bars. The colors are set by the colormap.

BAR(X,Y,WIDTH) or BAR(Y,WIDTH) specifies the width of the bars. Values

of WIDTH > 1, produce overlapped bars. The default value is WIDTH=0.8

BAR(...,'grouped') produces the default vertical grouped bar chart.

BAR(...,'stacked') produces a vertical stacked bar chart.

BAR(...,LINESPEC) uses the line color specified (one of 'rgbymckw').

BAR(AX,...) plots into AX instead of GCA.

H = BAR(...) returns a vector of handles to barseries objects.

Use SHADING FACETED to put edges on the bars. Use SHADING FLAT to

turn them off.

Examples: subplot(3,1,1), bar(rand(10,5),'stacked'), colormap(cool)

subplot(3,1,2), bar(0:.25:1,rand(5),1)

subplot(3,1,3), bar(rand(2,3),.75,'grouped')

See also hist, plot, barh, bar3, bar3h.

Overloaded methods:

fints/bar

Reference page in Help browser

doc bar

<barh> - Horizontal bar graph.

BARH Horizontal bar graph.

BARH(X,Y) draws the columns of the M-by-N matrix Y as M groups of

N horizontal bars. The vector X must not have duplicate values.

BARH(Y) uses the default value of X=1:M. For vector inputs,

BARH(X,Y) or BARH(Y) draws LENGTH(Y) bars. The colors are set by

the colormap.

BARH(X,Y,WIDTH) or BARH(Y,WIDTH) specifies the width of the

bars. Values of WIDTH > 1, produce overlapped bars. The

default value is WIDTH=0.8.

BARH(...,'grouped') produces the default horizontal grouped bar chart.

BARH(...,'stacked') produces a horizontal stacked bar chart.

BARH(...,LINESPEC) uses the line color specified (one of 'rgbymckw').

BARH(AX,...) plots into AX instead of GCA.

H = BARH(...) returns a vector of handles to barseries objects.

Use SHADING FACETED to put edges on the bars. Use SHADING FLAT to

turn them off.

Examples: subplot(3,1,1), barh(rand(10,5),'stacked'), colormap(cool)

subplot(3,1,2), barh(0:.25:1,rand(5),1)

subplot(3,1,3), barh(rand(2,3),.75,'grouped')

See also plot, bar, bar3, bar3h.

Overloaded methods:

fints/barh

<comet> - Comet-like trajectory.

COMET Comet-like trajectory.

COMET(Y) displays an animated comet plot of the vector Y.

COMET(X,Y) displays an animated comet plot of vector Y vs. X.

COMET(X,Y,p) uses a comet of length p*length(Y). Default is p = 0.10.

COMET(AX,...) plots into AX instead of GCA.

Example:

t = -pi:pi/200:pi;

comet(t,tan(sin(t))-sin(tan(t)))

See also comet3.

Reference page in Help browser

doc comet

<compass> - Compass plot.

COMPASS Compass plot.

COMPASS(U,V) draws a graph that displays the vectors with

components (U,V) as arrows emanating from the origin.

COMPASS(Z) is equivalent to COMPASS(REAL(Z),IMAG(Z)).

COMPASS(U,V,LINESPEC) and COMPASS(Z,LINESPEC) uses the line

specification LINESPEC (see PLOT for possibilities).

COMPASS(AX,...) plots into AX instead of GCA.

H = COMPASS(...) returns handles to line objects in H.

Example:

Z = eig(randn(20,20));

compass(Z)

See also rose, feather, quiver.

Reference page in Help browser

doc compass

<errorbar> - Error bar plot.

ERRORBAR Error bar plot.

ERRORBAR(X,Y,L,U) plots the graph of vector X vs. vector Y with

error bars specified by the vectors L and U. L and U contain the

lower and upper error ranges for each point in Y. Each error bar

is L(i) + U(i) long and is drawn a distance of U(i) above and L(i)

below the points in (X,Y). The vectors X,Y,L and U must all be

the same length. If X,Y,L and U are matrices then each column

produces a separate line.

ERRORBAR(X,Y,E) or ERRORBAR(Y,E) plots Y with error bars [Y-E Y+E].

ERRORBAR(...,'LineSpec') uses the color and linestyle specified by

the string 'LineSpec'. The color is applied to the data line and

error bars while the linestyle and marker are applied to the data

line only. See PLOT for possibilities.

ERRORBAR(AX,...) plots into AX instead of GCA.

H = ERRORBAR(...) returns a vector of errorbarseries handles in H.

For example,

x = 1:10;

y = sin(x);

e = std(y)*ones(size(x));

errorbar(x,y,e)

draws symmetric error bars of unit standard deviation.

Reference page in Help browser

doc errorbar

<ezplot> - Easy to use function plotter.

EZPLOT Easy to use function plotter

EZPLOT(FUN) plots the function FUN(X) over the default domain

-2*PI < X < 2*PI, where FUN(X) is an explicitly defined function of X.

EZPLOT(FUN2) plots the implicitly defined function FUN2(X,Y) = 0 over

the default domain -2*PI < X < 2*PI and -2*PI < Y < 2*PI.

EZPLOT(FUN,[A,B]) plots FUN(X) over A < X < B.

EZPLOT(FUN2,[A,B]) plots FUN2(X,Y) = 0 over A < X < B and A < Y < B.

EZPLOT(FUN2,[XMIN,XMAX,YMIN,YMAX]) plots FUN2(X,Y) = 0 over

XMIN < X < XMAX and YMIN < Y < YMAX.

EZPLOT(FUNX,FUNY) plots the parametrically defined planar curve FUNX(T)

and FUNY(T) over the default domain 0 < T < 2*PI.

EZPLOT(FUNX,FUNY,[TMIN,TMAX]) plots FUNX(T) and FUNY(T) over

TMIN < T < TMAX.

EZPLOT(FUN,[A,B],FIG), EZPLOT(FUN2,[XMIN,XMAX,YMIN,YMAX],FIG), or

EZPLOT(FUNX,FUNY,[TMIN,TMAX],FIG) plots the function over the

specified domain in the figure window FIG.

EZPLOT(AX,...) plots into AX instead of GCA or FIG.

H = EZPLOT(...) returns handles to the plotted objects in H.

Examples:

The easiest way to express a function is via a string:

ezplot('x^2 - 2*x + 1')

One programming technique is to vectorize the string expression using

the array operators .* (TIMES), ./ (RDIVIDE), .\ (LDIVIDE), .^ (POWER).

This makes the algorithm more efficient since it can perform multiple

function evaluations at once.

ezplot('x.*y + x.^2 - y.^2 - 1')

You may also use a function handle to an existing function. Function

handles are more powerful and efficient than string expressions.

ezplot(@humps)

ezplot(@cos,@sin)

EZPLOT plots the variables in string expressions alphabetically.

subplot(1,2,1), ezplot('1./z - log(z) + log(-1+z) + t - 1')

To avoid this ambiguity, specify the order with an anonymous function:

subplot(1,2,2), ezplot(@(z,t)1./z - log(z) + log(-1+z) + t - 1)

If your function has additional parameters, for example k in myfun:

%-----------------------%

function z = myfun(x,y,k)

z = x.^k - y.^k - 1;

%-----------------------%

then you may use an anonymous function to specify that parameter:

ezplot(@(x,y)myfun(x,y,2))

See also ezcontour, ezcontourf, ezmesh, ezmeshc, ezplot3, ezpolar,

ezsurf, ezsurfc, plot, vectorize, function_handle.

Overloaded methods:

sym/ezplot

Reference page in Help browser

doc ezplot

<ezpolar> - Easy to use polar coordinate plotter.

EZPOLAR Easy to use polar coordinate plotter.

EZPOLAR(FUN) plots the polar curve RHO = FUN(THETA) over the default

domain 0 < theta < 2*pi.

EZPOLAR(FUN,[A,B]) plots FUN for A < THETA < B.

EZPOLAR(AX,...) plots into AX instead of GCA.

H = EZPOLAR(...) returns a handle to the plotted object in H.

Examples

The easiest way to express a function is via a string:

ezpolar('sin(2*t)*cos(3*t)',[0 pi])

One programming technique is to vectorize the string expression using

the array operators .* (TIMES), ./ (RDIVIDE), .\ (LDIVIDE), .^ (POWER).

This makes the algorithm more efficient since it can perform multiple

function evaluations at once.

ezpolar('sin(2*t).*cos(3*t)',[0 pi])

You may also use a function handle to an existing function or an

anonymous function. These are more powerful and efficient than string

expressions.

ezpolar(@cos)

ezpolar(@(t)sin(3*t))

If your function has additional parameters, for example k1,k2 in myfun:

%-------------------------%

function s = myfun(t,k1,k2)

s = sin(k1*t).*cos(k2*t);

%-------------------------%

then you may use an anonymous function to specify the parameters:

ezpolar(@(t)myfun(t,2,3))

See also ezplot3, ezplot, ezsurf, plot, plot3, polar, vectorize,

function_handle.

Overloaded methods:

sym/ezpolar

Reference page in Help browser

doc ezpolar

<feather> - Feather plot.

FEATHER Feather plot.

FEATHER(U,V) plots the velocity vectors with components U and V as

arrows emanating from equally spaced points along a horizontal axis.

FEATHER is useful for displaying direction and magnitude data that

Is collected along a path.

FEATHER(Z) for complex Z is the same as FEATHER(REAL(Z),IMAG(Z)).

FEATHER(...,'LineSpec') uses the color and linestyle specification

from 'LineSpec' (see PLOT for possibilities).

FEATHER(AX,...) plots into AX instead of GCA.

H = FEATHER(...) returns a vector of line handles.

Example:

theta = (-90:10:90)*pi/180; r = 2*ones(size(theta));

[u,v] = pol2cart(theta,r);

feather(u,v), axis equal

See also compass, rose, quiver.

Reference page in Help browser

doc feather

<fill> - Filled 2-D polygons.

FILL Filled 2-D polygons.

FILL(X,Y,C) fills the 2-D polygon defined by vectors X and Y

with the color specified by C. The vertices of the polygon

are specified by pairs of components of X and Y. If necessary,

the polygon is closed by connecting the last vertex to the first.

If C is a single character string chosen from the list 'r','g','b',

'c','m','y','w','k', or an RGB row vector triple, [r g b], the

polygon is filled with the constant specified color.

If C is a vector the same length as X and Y, its elements are

scaled by CAXIS and used as indices into the current COLORMAP to

specify colors at the vertices; the color within the polygon is

obtained by bilinear interpolation in the vertex colors.

If X and Y are matrices the same size, one polygon per column

is drawn. In this case, C is a row vector for "flat" polygon

colors, and C is a matrix for "interpolated" polygon colors.

If either of X or Y is a matrix, and the other is a column vector

with the same number of rows, the column vector argument is

replicated to produce a matrix of the required size.

FILL(X1,Y1,C1,X2,Y2,C2,...) is another way of specifying

multiple filled areas.

FILL sets the PATCH object FaceColor property to 'flat', 'interp',

or a colorspec depending upon the value of the C matrix.

H = FILL(...) returns a column vector of handles to PATCH objects,

one handle per patch. The X,Y,C triples can be followed by

parameter/value pairs to specify additional properties of the patches.

See also patch, fill3, colormap, shading.

Overloaded methods:

cgoptimtablefiller/fill

cgoptimdatasetfiller/fill

cgnormfunction/fill

cglookuptwo/fill

cgfeature/fill

cgnormnode/fill

Reference page in Help browser

doc fill

<fplot> - Plot function.

FPLOT Plot function

FPLOT(FUN,LIMS) plots the function FUN between the x-axis limits

specified by LIMS = [XMIN XMAX]. Using LIMS = [XMIN XMAX YMIN YMAX]

also controls the y-axis limits. FUN(x) must return a row vector for

each element of vector x. For example, if FUN returns

[f1(x),f2(x),f3(x)] then for input [x1;x2] FUN should return

[f1(x1) f2(x1) f3(x1);

f1(x2) f2(x2) f3(x2)]

FPLOT(FUN,LIMS,TOL) with TOL < 1 specifies the relative error

tolerance. The default TOL is 2e-3, i.e. 0.2 percent accuracy.

FPLOT(FUN,LIMS,N) with N >= 1 plots the function with a minimum of N+1

points. The default N is 1. The maximum step size is restricted to be

(1/N)*(XMAX-XMIN).

FPLOT(FUN,LIMS,'LineSpec') plots with the given line specification.

FPLOT(FUN,LIMS,...) accepts combinations of the optional arguments

TOL, N, and 'LineSpec', in any order.

[X,Y] = FPLOT(FUN,LIMS,...) returns X and Y such that Y = FUN(X). No

plot is drawn on the screen.

FPLOT(AX,...) plots into AX instead of GCA.

Examples:

fplot(@humps,[0 1])

fplot(@(x)[tan(x),sin(x),cos(x)], 2*pi*[-1 1 -1 1])

fplot(@(x) sin(1./x), [0.01 0.1], 1e-3)

f = @(x,n)abs(exp(-1j*x*(0:n-1))*ones(n,1));

fplot(@(x)f(x,10),[0 2*pi])

See also plot, ezplot, function_handle.

Reference page in Help browser

doc fplot

<hist> - Histogram.

HIST Histogram.

N = HIST(Y) bins the elements of Y into 10 equally spaced containers

and returns the number of elements in each container. If Y is a

matrix, HIST works down the columns.

N = HIST(Y,M), where M is a scalar, uses M bins.

N = HIST(Y,X), where X is a vector, returns the distribution of Y

among bins with centers specified by X. The first bin includes

data between -inf and the first center and the last bin

includes data between the last bin and inf. Note: Use HISTC if

it is more natural to specify bin edges instead.

[N,X] = HIST(...) also returns the position of the bin centers in X.

HIST(...) without output arguments produces a histogram bar plot of

the results. The bar edges on the first and last bins may extend to

cover the min and max of the data unless a matrix of data is supplied.

HIST(AX,...) plots into AX instead of GCA.

Class support for inputs Y, X:

float: double, single

See also histc, mode.

Overloaded methods:

fints/hist

categorical/hist

Reference page in Help browser

doc hist

<pareto> - Pareto chart.

PARETO Pareto chart.

PARETO(Y,NAMES) produces a Pareto chart where the values in the

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