
Matlab’s command:
>> c1=5+b
Matlab’s response:
c1 =
7 6 7
Comments:
An element-by-element addition of vector
b
b with 5.
Matlab’s command:
>> d=a+b
Matlab’s response:
d =
1 3 -1
Comments:
An element-by-element addition of two equal length vectors.
Matlab’s command:
>> e=[2*a, c, d]
Matlab’s response:
e =
-2 4 -6 -5 10 -15 1 3 -1
Comments:
A larger vector is created after certain manipulations.
To refer to specific elements of the vector, the vector’s name is followed by
the element’s rank in brackets. For instance we can change the values of the
e
e vector with the following command:
Matlab’s command:
>> e(2)=-99; e(4)=-99; e(6)=-99;
>> e
Matlab’s response:
e =
-2 -99 -6 -99 10 -99 1 3 -1
2.1.1 The Colon Notation
The colon notation “:” can be used to pick out selected rows, columns and
elements of vectors, matrices, and arrays. It is a shortcut that is used to
create row vectors. Moreover, the colon notation is used to view or extract
Commentaires sur ces manuels