Skip to main content
Logo image

Section 2.9 Practice Your Matrices

Activity 2.8.

Create the following matrix by using vector notation for creating vectors with constant spacing and/or the linspace command. Do not type individual elements explicitly.
\begin{equation*} A = \begin{bmatrix} 0 & 5 & 10 & 15 & 20 & 25 & 30\\ 600 & 500 & 400 & 300 & 200 & 100 & 0\\ 0 & 0.8333 & 1.6667 & 2.5 & 3.3333 & 4.1667 & 5 \end{bmatrix} \end{equation*}

Activity 2.9.

Create the following matrix by using vector notation for creating vectors with constant spacing and/or the linspace command. Do not type individual elements explicitly.
\begin{equation*} B = \begin{bmatrix} 1 & 0 & 3\\ 2 & 0 & 3\\ 3 & 0 & 3\\ 4 & 0 & 3\\ 5 & 0 & 3 \end{bmatrix} \end{equation*}

Activity 2.10.

Create a matrix whose first row contains all zeros, the second row contains the numbers from 1 through n, the third the numbers from n to 1, where n is a variable with a positive integer value.

Activity 2.11.

The following vector is defined in MATLAB:
>> v = [15 0 6 -2 3 -5 4 9 1.8 -0.35 7]
Enter below what will be displayed if the following commands are executed by MATLAB. Check your answers by executing the commands with MATLAB.
>> a = v(2:5)
>> b = v([1,3:7, 11])
>> c = v([10, 2, 9, 4])
>> d = [v([2 7:10]); v([3, 5:7, 2])]
>> e = [v([3:5, 8])' v([10 6 4 1])' v(7:-1:4)']