MATLAB FINANCIAL DERIVATIVES TOOLBOX Bedienungsanleitung Seite 70

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 119
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 69
69
example and for the case of a scalar: 0 | 1, 1 | 0, and 1 | 1 is 1
(TRUE) while 0 | 0 is 0 (FALSE).
“~A” is a matrix whose elements are 1's where “A” has zero elements
and 0's where “A” has non-zero elements. For example and in the
case of a scalar: ~1 is (FALSE) and ~0 is 1 (TRUE).
Note that for Matlab, any number (integer or real, positive or negative)
different from 0 (zero) is a true statement, that is, it has the same meaning
as with 1. Pay also attention that the precedence with relational and logical
operators is the following (from highest to lowest):
1. Transpose “ .' ”, power “.^”, complex conjugate transpose “ ' “,
matrix power “^”;
2. Unary plus “+”, unary minus “-“, logical negation “~”;
3. Multiplication “.*”, right division “./”, left division that returns the
inverse of a division “.\”, matrix multiplication “*”, matrix right
division “/”, matrix left division “\”;
4. Addition “+”, subtraction “”;
5. Colon operator “:”;
6. Less than “<”, less than or equal to “<=”, greater than “>”, greater
than or equal to “>=”, equal to “==”, not equal to “~=”;
7. Element-wise logical AND “&”;
8. Element-wise logical OR “|”.
View the examples that follow to digest the use or logical and relational
operators.
Matlab’s command:
>> clear all; x=2; y=0; z=-2;
>> a=(x>=1), b=(x~=1 & y), c=(1|y & x>0), d=(~y & z | ~x == 5)
Matlab’s response:
a =
1
b =
0
c =
1
Seitenansicht 69
1 2 ... 65 66 67 68 69 70 71 72 73 74 75 ... 118 119

Kommentare zu diesen Handbüchern

Keine Kommentare