Download LME for Pocket PC User Manual

Transcript
18
LMEPPC User Manual ©1999-2008, Calerga Sàrl
The division symbol / denotes the multiplication by the inverse of the
right argument (which must be a square matrix). To multiply by the
inverse of the left argument, use the symbol \. This is handy to solve
a set of linear equations. For example, to find the values of  and y
such that  + 2y = 2 and 3 + 4y = 7, type
> [1,2;3,4] \ [2;7]
ans =
3
-0.5
Hence  = 3 and y = −0.5. Another way to solve this problem is
to use the inv function, which return the inverse of its argument. It is
sometimes useful to multiply or divide matrices element-wise. The .*,
./ and .\ operators do exactly that. Note that the + and - operators
do not need special dot versions, because they perform element-wise
anyway.
> [1,2;3,4] * [2,1;5,3]
ans =
12 7
26 15
> [1,2;3,4] .* [2,1;5,3]
ans =
2 2
15 12
Some functions change the order of elements. The transpose operator
(tick) reverses the columns and the rows:
> [1,2;3,4;5,6]’
ans =
1 3 5
2 4 6
When applied to complex matrices, the complex conjugate transpose
is obtained. Use dot-tick if you just want to reverse the rows and
columns. The flipud function flips a matrix upside-down, and fliplr
flips a matrix left-right.
> flipud([1,2;3,4])
ans =
3 4
1 2
> fliplr([1,2;3,4])
ans =
2 1
4 3
To sort the elements of each column of a matrix, or the elements of a
row vector, use the sort function: