log(2)
ans =
0.6931
format compact
log(2)
ans =
0.6931
help format
FORMAT Set output format.
FORMAT with no inputs sets the ouput format to the default appropriate
for the class of the variable. For float variables, the default is
FORMAT SHORT.
FORMAT does not affect how MATLAB computations are done. Computations
on float variables, namely single or double, are done in appropriate
floating point precision, no matter how those variables are displayed.
Computations on integer variables are done natively in integer. Integer
variables are always displayed to the appropriate number of digits for
the class, for example, 3 digits to display the INT8 range -128:127.
FORMAT SHORT and LONG do not affect the display of integer variables.
FORMAT may be used to switch between different output display formats
of all float variables as follows:
FORMAT SHORT Scaled fixed point format with 5 digits.
FORMAT LONG Scaled fixed point format with 15 digits for double
and 7 digits for single.
FORMAT SHORT E Floating point format with 5 digits.
FORMAT LONG E Floating point format with 15 digits for double and
7 digits for single.
FORMAT SHORT G Best of fixed or floating point format with 5 digits.
FORMAT LONG G Best of fixed or floating point format with 15 digits
for double and 7 digits for single.
FORMAT may be used to switch between different output display formats
of all numeric variables as follows:
FORMAT HEX Hexadecimal format.
FORMAT + The symbols +, - and blank are printed
for positive, negative and zero elements.
Imaginary parts are ignored.
FORMAT BANK Fixed format for dollars and cents.
FORMAT RAT Approximation by ratio of small integers.
FORMAT may be used to affect the spacing in the display of all
variables as follows:
FORMAT COMPACT Suppresses extra line-feeds.
FORMAT LOOSE Puts the extra line-feeds back in.
Example:
format short, pi, single(pi)
displays both double and single pi with 5 digits as 3.1416 while
format long, pi, single(pi)
displays pi as 3.14159265358979 and single(pi) as 3.1415927.
format, intmax('uint64'), realmax
shows these values as 18446744073709551615 and 1.7977e+308 while
format hex, intmax('uint64'), realmax
shows them as ffffffffffffffff and 7fefffffffffffff respectively.
The HEX display corresponds to the internal representation of the value
and is not the same as the hexadecimal notation in the C programming
language.
See also disp, display, isnumeric, isfloat, isinteger.
Reference page in Help browser
doc format
format long e
log(2)
ans =
6.931471805599453e-01
format long g
log(2)
ans =
0.693147180559945
3+4
ans =
7
5*55
ans =
275
a = 5
a =
5
b = 8
b =
8
who
Your variables are:
a ans b
whos
Name Size Bytes Class
a 1x1 8 double array
ans 1x1 8 double array
b 1x1 8 double array
Grand total is 3 elements using 24 bytes
m = [1,2,3,4,5]
m =
1 2 3 4 5
whos
Name Size Bytes Class
a 1x1 8 double array
ans 1x1 8 double array
b 1x1 8 double array
m 1x5 40 double array
Grand total is 8 elements using 64 bytes
n = [5;4;3;2;1]
n =
5
4
3
2
1
whos
Name Size Bytes Class
a 1x1 8 double array
ans 1x1 8 double array
b 1x1 8 double array
m 1x5 40 double array
n 5x1 40 double array
Grand total is 13 elements using 104 bytes
m * n
ans =
35
n * m
ans =
5 10 15 20 25
4 8 12 16 20
3 6 9 12 15
2 4 6 8 10
1 2 3 4 5
m + 10
ans =
11 12 13 14 15
m / 10
ans =
Columns 1 through 4
0.1 0.2 0.3 0.4
Column 5
0.5
help /
Operators and special characters.
Arithmetic operators.
plus - Plus +
uplus - Unary plus +
minus - Minus -
uminus - Unary minus -
mtimes - Matrix multiply *
times - Array multiply .*
mpower - Matrix power ^
power - Array power .^
mldivide - Backslash or left matrix divide \
mrdivide - Slash or right matrix divide /
ldivide - Left array divide .\
rdivide - Right array divide ./
kron - Kronecker tensor product kron
Relational operators.
eq - Equal ==
ne - Not equal ~=
lt - Less than <
gt - Greater than >
le - Less than or equal <=
ge - Greater than or equal >=
Logical operators.
Short-circuit logical AND &&
Short-circuit logical OR ||
and - Element-wise logical AND &
or - Element-wise logical OR |
not - Logical NOT ~
xor - Logical EXCLUSIVE OR
any - True if any element of vector is nonzero
all - True if all elements of vector are nonzero
Special characters.
colon - Colon :
paren - Parentheses and subscripting ( )
paren - Brackets [ ]
paren - Braces and subscripting { }
punct - Function handle creation @
punct - Decimal point .
punct - Structure field access .
punct - Parent directory ..
punct - Continuation ...
punct - Separator ,
punct - Semicolon ;
punct - Comment %
punct - Invoke operating system command !
punct - Assignment =
punct - Quote '
transpose - Transpose .'
ctranspose - Complex conjugate transpose '
horzcat - Horizontal concatenation [,]
vertcat - Vertical concatenation [;]
subsasgn - Subscripted assignment ( ),{ },.
subsref - Subscripted reference ( ),{ },.
subsindex - Subscript index
Bitwise operators.
bitand - Bit-wise AND.
bitcmp - Complement bits.
bitor - Bit-wise OR.
bitmax - Maximum floating point integer.
bitxor - Bit-wise XOR.
bitset - Set bit.
bitget - Get bit.
bitshift - Bit-wise shift.
Set operators.
union - Set union.
unique - Set unique.
intersect - Set intersection.
setdiff - Set difference.
setxor - Set exclusive-or.
ismember - True for set member.
See also arith, relop, slash, function_handle.
Reference page in Help browser
doc mrdivide
zeros(5)
ans =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
help zeros
ZEROS Zeros array.
ZEROS(N) is an N-by-N matrix of zeros.
ZEROS(M,N) or ZEROS([M,N]) is an M-by-N matrix of zeros.
ZEROS(M,N,P,...) or ZEROS([M N P ...]) is an M-by-N-by-P-by-... array of
zeros.
ZEROS(SIZE(A)) is the same size as A and all zeros.
ZEROS with no arguments is the scalar 0.
ZEROS(M,N,...,CLASSNAME) or ZEROS([M,N,...],CLASSNAME) is an
M-by-N-by-... array of zeros of class CLASSNAME.
Example:
x = zeros(2,3,'int8');
See also eye, ones.
Reference page in Help browser
doc zeros
zeros(5,1)
ans =
0
0
0
0
0
lookfor indentity
indentity not found.
lookfor identity
EYE Identity matrix.
SPEYE Sparse identity matrix.
DSPBLKEYE is the mask function for the Signal Processing Blockset Identity
eye(6)
ans =
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
load mattest.txt
whos
Name Size Bytes Class
a 1x1 8 double array
ans 6x6 288 double array
b 1x1 8 double array
m 1x5 40 double array
mattest 5x1 40 double array
n 5x1 40 double array
Grand total is 53 elements using 424 bytes
log(mattest)
ans =
1.6094379124341 + 3.14159265358979i
1.09861228866811 + 3.14159265358979i
0.693147180559945
0
1.6094379124341
mattest
mattest =
-5
-3
2
1
5
plot(mattest)
help plot
PLOT Linear plot.
PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix,
then the vector is plotted versus the rows or columns of the matrix,
whichever line up. If X is a scalar and Y is a vector, length(Y)
disconnected points are plotted.
PLOT(Y) plots the columns of Y versus their index.
If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)).
In all other uses of PLOT, the imaginary part is ignored.
Various line types, plot symbols and colors may be obtained with
PLOT(X,Y,S) where S is a character string made from one element
from any or all the following 3 columns:
b blue . point - solid
g green o circle : dotted
r red x x-mark -. dashdot
c cyan + plus -- dashed
m magenta * star (none) no line
y yellow s square
k black d diamond
v triangle (down)
^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
h hexagram
For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus
at each data point; PLOT(X,Y,'bd') plots blue diamond at each data
point but does not draw any line.
PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by
the (X,Y,S) triples, where the X's and Y's are vectors or matrices
and the S's are strings.
For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a
solid yellow line interpolating green circles at the data points.
The PLOT command, if no color is specified, makes automatic use of
the colors specified by the axes ColorOrder property. The default
ColorOrder is listed in the table above for color systems where the
default is blue for one line, and for multiple lines, to cycle
through the first six colors in the table. For monochrome systems,
PLOT cycles over the axes LineStyleOrder property.
If you do not specify a marker type, PLOT uses no marker.
If you do not specify a line style, PLOT uses a solid line.
PLOT(AX,...) plots into the axes with handle AX.
PLOT returns a column vector of handles to lineseries objects, one
handle per plotted line.
The X,Y pairs, or X,Y,S triples, can be followed by
parameter/value pairs to specify additional properties
of the lines. For example, PLOT(X,Y,'LineWidth',2,'Color',[.6 0 0])
will create a plot with a dark red line width of 2 points.
Backwards compatibility
PLOT('v6',...) creates line objects instead of lineseries
objects for compatibility with MATLAB 6.5 and earlier.
See also plottools, semilogx, semilogy, loglog, plotyy, plot3, grid,
title, xlabel, ylabel, axis, axes, hold, legend, subplot, scatter.
Overloaded functions or methods (ones with the same name in other directories)
help phytree/plot.m
help cfit/plot.m
help dspdata/plot.m
help wvtree/plot.m
help rwvtree/plot.m
help edwttree/plot.m
help wdectree/plot.m
help ntree/plot.m
help dtree/plot.m
Reference page in Help browser
doc plot
plot(mattest, 'm')
plot(mattest, 'md')
plot(mattest, 'md-')
plot(mattest, 'd-')
plot(mattest, 'm-', mattest, 'cd')
??? Error using ==> plot
Not enough input arguments.
plot(mattest, mattest, 'm-', mattest, mattest, 'cd')
diary off