You are on page 1of 2

EXERCISE 3

1. (a) Create a row vector that has the elements: 32, 4, 81, e
2.5
, 63, cos(/3) and 14.12.
(b) Create a column vector that has the elements: 55, 14, ln(51), 987, 0 and 5sin(2.5 ).

(c) Create a row vector in which the first element is 1, the last element is 33, with an
increment of 2 between the elements.

(d) Create a column vector in which the first element is 15, the last element is 25, with
an increment of 5 between the elements.

(e) Create a row vector with 15 equally spaced elements in which the first element is 7
and the last element is 40.
(f)
Create a column vector with 12 equally spaced elements in which the first element is
1 and the last element is 15.

2. Create a vector A1 that has 16 elements in which the first element is 4, the increment is 3 and
the last element is 49. Then, using the colon symbol, create a new vector A2 that has eight
elements. The first four elements of A2 are the first four elements of the vector A1 and the
last four are the last four elements of the vector A1.

3. Create the matrix shown below by creating vector rows.

=
1 4 7 10 13 16 19 22 25
72 66 60 54 48 42 36 30 24
0 0.125 0.250 0.375 0.500 0.625 0.750 0.875 1.000


4. Create the following matrix :

=
6 43 2 11 87
12 6 34 0 5
34 18 7 41 9

Use the matrix to:
(a) Create a five-element row vector named 1 that contains the elements of the second row
of .
(b) Create a three-element row vector named 2 that contains the elements of the fourth
column of .
(c) Create a ten-element row vector named 3 that contains the elements of the first and
second rows of .
(d) Create a six-element row vector named 4 that contains the elements of the second and
fifth columns of .

5. Create the following matrix :

=
2 4 6 8 10
3 6 9 12 15
7 14 21 28 35

Use the matrix to:
(a) Create a three-element column vector named 1 that contains the elements of the third
column of .
(b) Create a five-element column vector named 2 that contains the elements of the second
row of .
(c) Create a nine-element column vector named 3 that contains the elements of the first,
third and fifth columns of .
(d) Create a ten-element column vector named 4 that contains the elements of the first and
second rows of .

6. Create the following matrix :

=
1 2 3 4 5 6 7
2 4 6 8 10 12 14
21 18 15 12 9 6 3
5 10 15 20 25 30 35


(a) Create a 3 4 matrix from the first, third and fourth rows and the first, third through
seventh columns of the matrix .
(b) Create a fifteen-element row vector named from the elements of the third row, and the
fifth and seventh columns of the matrix .

7. Create the following matrices.

(a)
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
(b)
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
(c)
1 1
1 1
1 1
1 1


8. Create a 3 4 matrix in which all the elements are 1, and create a 2 2 matrix in which
all the elements are 5. Then, add elements to the matrix by appending the matrix such
that will be:

=

1 1 1 0 0
1 1 1 0 0
1 1 1 0 0
0 0 0 5 5
0 0 0 5 5

You might also like