MATLAB FINANCIAL DERIVATIVES TOOLBOX Uživatelský manuál Strana 42

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 119
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 41
41
in the workspace; use the
w
w
h
h
o
o function to view the variables that you have
saved in the workspace or view them from the workspace browser):
Matlab’s command:
>> A(1,2), A(2,3), A(2,4)
Matlab’s response:
ans =
-2
ans =
4
ans =
1
Comments:
Extracting specific elements from a matrix.
So, in Matlab, to refer to a certain matrix element, after the matrix name the
element’s index/position is enclosed in parenthesis. This is similar with the
indexing of vectors elements with the exception that in the case of matrices,
two indexes should be used (the first one indicates the row number whilst
the second the column number). In general, the syntax for manipulating a
matrix element in Matlab is:
“K(row_index, column_index)”
where
K
K is an
n
m
×
matrix, row_index indicates the row in which an
element lays and column_index the according column. The upper left
position in a matrix has (1,1) coordinates. row_index can take all integer
values smaller than m, inclusive, while column_index can also take all
integer values smaller than n, inclusive (note that Matlab can handle
multidimensional arrays just by putting additional indexes to control the
higher dimensions).
Moreover, Matlab has an additional way to refer to matrix elements just by
using a single index number in the brackets after the declaration of the
matrix name. Starting from the upper left element that represents the first
element (1)of the matrix, further reference to additional elements is done
incrementally one by one and column-wise. That is, the element with
Zobrazit stránku 41
1 2 ... 37 38 39 40 41 42 43 44 45 46 47 ... 118 119

Komentáře k této Příručce

Žádné komentáře