MATLAB POLYSPACE RELEASE NOTES Manual de usuario Pagina 147

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 240
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 146
Other Data Structures
Other Data Structures
In this section.. .
“Multidimensional A rrays” on page 4-9
“Cell Arrays” on page 4-11
“Characters and Text” on page 4-13
“Structures” on page 4-16
Multidimensional Arrays
Multidimensional arrays in MATLAB are arrays with more than two
subscripts. One way of creating a multidimensional array is by calling
zeros,
ones, rand,orrandn with more than two arguments. For example,
R = randn(3,4,5);
creates a 3-by-4-by-5 array with a total of 3 *4* 5 = 60 normally distributed
random elements.
A three-dimensional array might represent three-dimensional phys ical data,
say the temperature in a room, sampled on a rectangular grid. Or it might
represent a sequence of m atrices, A
(k)
, or sam ples of a time-dependent m atrix ,
A(t). In these latter cases, the (i, j)th element of the kth matrix, or the t
k
th
matrix, is denoted by
A(i,j,k).
MATLAB and Dürer’s versions of the magic square of order 4 differ by an
interchange of two columns. Many different magic squares can be generated
by interchanging columns. The statement
p = perms(1:4);
generates the 4! = 24 permutations of 1:4.Thekth perm utation is the row
vector
p(k,:).Then
A = magic(4);
M = zeros(4,4,24);
for k = 1:24
4-9
Vista de pagina 146
1 2 ... 142 143 144 145 146 147 148 149 150 151 152 ... 239 240

Comentarios a estos manuales

Sin comentarios