当前位置:文档之家› matlab 常用函数(1)

matlab 常用函数(1)

A
axis()
axis([xmin xmax ymin ymax]) sets the limits for the x- and y-axis of the current axes.
axis([xmin xmax ymin ymax zmin zmax cmin cmax]) sets the x-, y-, and z-axis limits and the color scaling limits (see caxis) of the current axes.
axis equal sets the aspect ratio so that the data units are the same in every direction. The aspect ratio of the x-, y-, and z-axis is adjusted automatically according to the range of data units in the x, y, and z directions
C
clf
Clear current figure window
G
grid off/on
The grid function turns the current axes' grid lines on and off.
H
hold on/off
●The hold function determines whether new graphics objects are added to the graph or
replace objects in the graph.
●hold on retains the current plot and certain axes properties so that subsequent
graphing commands add to the existing graph.
●hold off resets axes properties to their defaults before drawing new plots. hold off
is the default
P
plot(X1,Y1,LineSpec,...)
LineSpec is a line specification that determines line type, marker symbol, and color of the plotted lines
●Line Style Specifiers
●Marker Specifiers
●Color Specifiers
●LineWidth -- Specifies the width (in points) of the line.
●MarkerEdgeColor -- Specifies the color of the marker or the edge color for filled
markers (circle, square, diamond, pentagram, hexagram, and the four triangles).
●MarkerFaceColor -- Specifies the color of the face of filled markers.
●MarkerSize -- Specifies the size of the marker in units of points.
For example
plot(x,y,'--rs','LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',10)
T
text()
Create text object in current axes
text(x,y,'string') adds the string in quotes to the location specified by the point (x,y).
text(pi,0,' \leftarrow sin(\pi)','FontSize',18)
S
shg:
显示图形窗口.
solve
S = solve(eqn) solves the equation eqn for the default variable determined by symvar. You can specify the independent variable.
For example, solve(x + 1 == 2,x) solves the equation x + 1 = 2 with respect to the variable x.
syms x y
S = solve(x + y == 1, x - 11*y == 5)
S =
x: [1x1 sym]
y: [1x1 sym]
To display the solutions, access the elements of the structure array S:
S = [S.x S.y]
S =
[ 4/3, -1/3]
syms a b c x
solve(a*x^2 + b*x + c == 0, a)
solve(a*x^2 + b*x + c == 0, b)The result is:ans =
-(c + b*x)/x^2
ans =
-(a*x^2 + c)/x
R
roots ()
Polynomial roots
r = roots(c) returns a column vector whose elements are the roots of the polynomial c.
Row vector c contains the coefficients of a polynomial, ordered in
descending powers. If c has n+1 components, the polynomial it represents is
X
xlable() ylable()
Label the x-, y-, and z-axis
xlabel('string') labels the x-axis of the current axes。

相关主题