Syntax
axis([xmin xmax ymin ymax])
axis([xmin xmax ymin ymax zmin zmax cmin cmax])
v = axis
axis auto
axis manual
axis tight
axis fill
axis ij
axis xy
axis equal
axis image
axis squareaxis vis3d
axis normal
axis off
axis on
Description
axis
manipulates commonly used axes properties. (See Algorithm section.)
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.
v = axis
returns a row vector containing scaling factors for the x-, y-, and z-axis. v
has four or six components depending on whether the current axes is 2-D or 3-D, respectively. The returned values are the current axes' XLim
, Ylim
, and ZLim
properties.
axis auto
sets MATLAB to its default behavior of computing the current axes' limits automatically, based on the minimum and maximum values of x, y, and z data. You can restrict this automatic behavior to a specific axis. For example, axis
'auto
x'
computes only the x-axis limits automatically; axis
'auto yz'
computes the y- and z-axis limits automatically.
axis manual and axis(axis)
freezes the scaling at the current limits, so that if hold
is on
, subsequent plots use the same limits. This sets the XLimMode
, YLimMode
, and ZLimMode
properties to manual
.
axis tight
sets the axis limits to the range of the data.
axis fill
sets the axis limits and PlotBoxAspectRatio
so that the axes fill the position rectangle. This option has an effect only if PlotBoxAspectRatioMode
or DataAspectRatioMode
are manual
.
axis ij
places the coordinate system origin in the upper-left corner. The i-axis is vertical, with values increasing from top to bottom. The j-axis is horizontal with values increasing from left to right.
axis xy
draws the graph in the default Cartesian axes format with the coordinate system origin in the lower-left corner. The x-axis is horizontal with values increasing from left to right. The y-axis is vertical with values increasing from bottom to top.
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.
axis image
is the same as axis equal
except that the plot box fits tightly around the data.
axis square
makes the current axes region square (or cubed when three-dimensional). MATLAB adjusts the x-axis, y-axis, and z-axis so that they have equal lengths and adjusts the increments between data units accordingly.
axis vis3d
freezes aspect ratio properties to enable rotation of 3-D objects and overrides stretch-to-fill.
axis normal
automatically adjusts the aspect ratio of the axes and the relative scaling of the data units so that the plot fits the figures shape as best as possible.
axis off
turns off all axis lines, tick marks, and labels.
axis on
turns on all axis lines, tick marks, and labels.
axis(
applies the axes_handles
,...) axis
command to the specified axes. For example, the following statements
[mode,visibility,direction] = axis('state')
returns three strings indicating the current setting of axes properties:
Output Argument | Strings Returned |
|
|
|
|
|
|
mode
is auto
if XLimMode
, YLimMode
, and ZLimMode
are all set to auto
. If XLimMode
, YLimMode
, or ZLimMode
is manual
, mode
is manual
.
Examples
use the automatic scaling of the y-axis based on ymax = tan(1.57)
, which is well over 1000:
The right figure shows a more satisfactory plot after typing
Algorithm
When you specify minimum and maximum values for the x-, y-, and z-axes, axis
sets the XLim
, Ylim
, and ZLim
properties for the current axes to the respective minimum and maximum values in the argument list. Additionally, the XLimMode
, YLimMode
, and ZLimMode
properties for the current axes are set to manual
.
axis auto
sets the current axes' XLimMode
, YLimMode
, and ZLimMode
properties to 'auto'
.
axis manual
sets the current axes' XLimMode
, YLimMode
, and ZLimMode
properties to 'manual'
.
axis equal
,axis normal
, axis square
, and axis image
.balance
Diagonal scaling to improve eigenvalue accuracy
Syntax
Description
[T,B] = balance(A)
returns a similarity transformation T
such that B = T\A*T
, and B
has approximately equal row and column norms. T
is a permutation of a diagonal matrix whose elements are integer powers of two to prevent the introduction of round-off error. If A
is symmetric, then B == A
and T
is the identity matrix.
B = balance(A)
returns just the balanced matrix B
.
Remarks
Nonsymmetric matrices can have poorly conditioned eigenvalues. Small perturbations in the matrix, such as roundoff errors, can lead to large perturbations in the eigenvalues. The condition number of the eigenvector matrix,
relates the size of the matrix perturbation to the size of the eigenvalue perturbation. Note that the condition number of A
itself is irrelevant to the eigenvalue problem.
Balancing is an attempt to concentrate any ill conditioning of the eigenvector matrix into a diagonal scaling. Balancing usually cannot turn a nonsymmetric matrix into a symmetric matrix; it only attempts to make the norm of each row equal to the norm of the corresponding column.
Note The MATLAB eigenvalue function, eig(A) , automatically balances A before computing its eigenvalues. Turn off the balancing with eig(A,'nobalance') . |
Examples
This example shows the basic idea. The matrix A
has large elements in the upper right and small elements in the lower left. It is far from being symmetric.
A = [1 100 10000; .01 1 100; .0001 .01 1]
A =
1.0e+04 *
0.0001 0.0100 1.0000
0.0000 0.0001 0.0100
0.0000 0.0000 0.0001
Balancing produces a diagonal matrix T
with elements that are powers of two and a balanced matrix B
that is closer to symmetric than A
.
[T
,
B] = balance(A)
T =
1.0e+03 *
2.0480 0 0
0 0.0320 0
0 0 0.0003
B =
1.0000 1.5625 1.2207
0.6400 1.0000 0.7813
0.8192 1.2800 1.0000
To see the effect on eigenvectors, first compute the eigenvectors of A
, shown here as the columns of V
.
Note that all three vectors have the first component the largest. This indicates V
is badly conditioned; in fact cond(V)
is 8.7766e+003
. Next, look at the eigenvectors of B
.
Now the eigenvectors are well behaved and cond(V)
is 1.4421
. The ill conditioning is concentrated in the scaling matrix; cond(T)
is 8192
.
This example is small and not really badly scaled, so the computed eigenvalues of A
and B
agree within roundoff error; balancing has little effect on the computed results.
Algorithm
balance
uses LAPACK routines DGEBAL
(real) and ZGEBAL
(complex). If you request the output T
, it also uses the LAPACK routines DGEBAK
(real) and ZGEBAK
(complex).
Limitations
Balancing can destroy the properties of certain matrices; use it with some care. If a matrix contains small elements that are due to roundoff error, balancing may scale them up to make them as significant as the other elements of the original matrix.
No comments:
Post a Comment