Graphics Programs Reference
In-Depth Information
1.3 Matrices
The basic object that matlab deals with is a matrix. A matrix is an
array of numbers. For example the following are matrices:
,
12345
,
i
12
3
9
−
i
i
−
1200 0 1e6
0
.
1 i
/
3
,
42
.
−
i
The size of a matrix is the number of rows by the number of columns.
The first matrix is a 3
×
3 matrix. The (2,3)-element is one million—1e6
10
6
—and the (3,2)-element is pi =
π
=3
.
14159
...
.
The second matrix is a row-vector, the third matrix is a column-vector
containing the number
i
, which is a pre-defined matlab variable equal
to the square root of
stands for 1
×
−
×
1. The last matrix is a 1
1 matrix, also called
a scalar.
1.4 Variables
Variables in matlab are named objects that are assigned using the
equals sign
=
. They are limited to 31 characters and can contain
upper and lowercase letters, any number of '
_
' characters, and numer-
als. They may not start with a numeral. matlab is case sensitive:
A
and
a
are different variables. The following are valid matlab variable
assignments:
a=1
speed = 1500
BeamFormerOutput_Type1 = v*Q*v'
name = 'John Smith'
These are invalid assignments:
2for1 = 'yes'
first one = 1
To assign a variable without getting an echo from matlab end the
assignment with a semi-colon
;
. Try typing the following:
a=2
b=3;
c = a+b;
d = c/2;
d
who
whos
clear
who