MATLAB POLYSPACE RELEASE NOTES Manuel d'utilisateur Page 40

  • 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 39
2 Matrices and Arra ys
9.0 6.0 7.0 12.0
4.0 15.0 14.0 1.0 ];
The statement
magik
reads the file and creates a variable, A, containing the example matrix.
Concatenation
Concatenation is the proce ss of joining small matrices to make bigger ones. In
fact, you made your first matrix by concatenating its individual elements. The
pair of square brackets,
[], is the concatenation operator. For an example,
start with the 4-by-4 magic square,
A,andform
B = [A A+32; A+48 A+16]
The result is an 8-by-8 m atrix, obtained by joining the four submatrice s:
B=
16 3 2 1 3 48 35 34 45
5 10 11 8 37 42 43 40
9 6 7 1 2 41 38 39 44
4 15 14 1 36 47 46 33
64 51 50 61 32 19 18 29
53 58 59 56 21 26 27 24
57 54 55 60 25 22 23 28
52 63 62 49 20 31 30 17
This matrix is halfway to being another magic square. Its elements are a
rearrangement of the integers
1:64. Its column sums are the correct value
for an 8-by-8 magic square:
sum(B)
ans =
260 260 260 260 260 260 260 260
But its row sums, sum(B')', are not all the same. Further m anipulation is
necessary to make this a valid 8-by-8 magic square.
2-18
Vue de la page 39
1 2 ... 35 36 37 38 39 40 41 42 43 44 45 ... 239 240

Commentaires sur ces manuels

Pas de commentaire