MATLAB FINANCIAL DERIVATIVES TOOLBOX Bedienungsanleitung Seite 72

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 119
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 71
71
matrix, returning a row vector of 1's and 0's. The second one,
a
a
l
l
l
l, becomes
TRUE if all elements of a vector are nonzero. For vectors,
a
a
l
l
l
l returns 1 if
none of the elements of the vector are zero. Otherwise it returns 0. For
matrices,
a
a
l
l
l
l operates on the columns of the matrix, returning a row vector
of 1's and 0's. View the following code to understand these tow functions.
Matlab’s command:
>> clear all; z=[-5 2 0]; x=[5 0 -1; 2 4 8]; y=[2 1 -1; 1 2 4];
>> a1=any(z), a2=any(x), a3=any(y), a4=all(z), a5=all(x), a6=all(y)
Matlab’s response:
a1 =
1
a2 =
1 1 1
a3 =
1 1 1
a4 =
0
a5 =
1 0 1
a6 =
1 1 1
Comments:
Displaying the use of
a
a
n
n
y
y and
a
a
l
l
l
l.
4.2. Conditional Statements
The above section has been introduced since it is necessary for the
evaluation of conditional statements as well as loop expressions (see the
following section). A conditional statement is a segment of programming
code that evaluates a statement; if the statement is TRUE then it executes
some commands, otherwise if it is FALSE it runs a bulk of different
programming code. The two most important conditional statements that
Matlab materialize, is the
i
i
f
f statement and the
s
s
w
w
i
i
t
t
c
c
h
h statement.
Seitenansicht 71
1 2 ... 67 68 69 70 71 72 73 74 75 76 77 ... 118 119

Kommentare zu diesen Handbüchern

Keine Kommentare