Replaces the first and third columns of a by the fourth and second columns of b ( a and b must have the same number of rows). You can use vector subscripts to get more complicated effects, e.g., Suppose we want a table trig of the sines and cosines of the angles 0 ∘ to 180 ∘ in steps of 30 ∘. This feature may be used, for example, to construct tables. So a(3,:) means all elements in the third row. However, a colon by itself in place of a subscript denotes all the elements of the corresponding row or column. The colon operator is extremely powerful, and provides for very efficient ways of handling matrices, e.g., if a is the matrixħ 8 (returns second and third rows, first and second columns), the statementħ 8 9 (replaces the 2-by-2 submatrix composed of the first and second row and the second and third column with a square matrix of 1s).Įssentially, what is happening in the above examples is that the colon operator is being used to create vector subscripts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |