MATLAB POLYSPACE RELEASE NOTES Manuel d'utilisateur Page 49

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 240
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 48
More About Matrices and Arrays
Scalar Expansio
n
Matrices and sca
lars can be combined in several different ways. For example,
ascalarissubtr
acted from a matrix by subtracting it from each element. The
average value of
the elements in our magic square is 8.5, so
B=A-8.5
forms a matrix w
hose column sums are zero:
B=
7.5 -5.5 -6.5 4.5
-3.5 1.5 2.5 -0.5
0.5 -2.5 -1.5 3.5
-4.5 6.5 5.5 -7.5
sum(B)
ans =
0000
With scalar expan
sion, MATLAB assigns a s pe c if ied scala r to all i n dices in a
range. For exampl
e,
B(1:2,2:3) = 0
zeroes out a port
ion o f
B:
B=
7.5 0 0 4.5
-3.5 0 0 -0.5
0.5 -2.5 -1.5 3.5
-4.5 6.5 5.5 -7.5
Logical Subscrip
ting
The logical vecto
rs created from logical and relational operations can be us ed
to reference suba
rrays. Suppose
X is an ordinary matrix and L is a matri x of
thesamesizetha
t is the result of some logical operation. Then
X(L) specifies
the elements of
X
where the elements of L are nonzero.
2-27
Vue de la page 48
1 2 ... 44 45 46 47 48 49 50 51 52 53 54 ... 239 240

Commentaires sur ces manuels

Pas de commentaire