
More About Matrices and Arrays
Then
pows = [n n.^2 2.^n ]
builds a table of squares and p owers of 2:
pows =
001
112
244
398
41616
52532
63664
749128
864256
981512
The elementary m ath functions operate on arrays element by element. So
format short g
x = (1:0.1:2)';
logs = [x log1 0(x)]
builds a table of logarithms.
logs =
1.0 0
1.1 0.04139
1.2 0.07918
1.3 0.11394
1.4 0.14613
1.5 0.17609
1.6 0.20412
1.7 0.23045
1.8 0.25527
1.9 0.27875
2.0 0.30103
2-25
Commentaires sur ces manuels