MATLAB FINANCIAL DERIVATIVES TOOLBOX Manuel d'utilisateur Page 31

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 119
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 30
30
2.1.3 Transporting Vectors
To perform operation with column and row vectors of similar length, it is
first needed to transpose the vectors in order to make them either all row
vectors or column ones. The apostrophe symbol “ ' “ is used to convert a
column vector to a row one and vise versa. Remember that the length of the
vectors must match; otherwise, Matlab will return an error. Experiment with
the following examples to learn the use of transpose command.
Matlab’s command:
>> z1 = [2 -1 3], z2 = z1', z3 = z2'''
Matlab’s response:
z1 =
2 -1 3
z2 =
2
-1
3
z3 =
2 -1 3
Comments:
z
z
1
1 is a three element row vector.
z
z
2
2 is the transpose of
z
z
1
1.
z
z
3
3 is
similar with
z
z
1
1 since after transposing
z
z
2
2 three times is similar as
transposing once the
z
z
2
2.
Matlab’s command:
>> z1'+z2, z1+z2
Matlab’s response:
ans =
4
-2
6
??? Error using ==> +
Matrix dimensions must agree.
Comments:
z
z
1
1
'
'
+
+
z
z
2
2 operation involves the addition of two column vectors.
z
z
1
1
+
+
z
z
2
2 is an illegal operation since a row vector cannot be added
with a column vector.
Note that that Matlab can store empty vectors. This is done as follows:
Vue de la page 30
1 2 ... 26 27 28 29 30 31 32 33 34 35 36 ... 118 119

Commentaires sur ces manuels

Pas de commentaire