Instructions:¶
Submit your work in the form of a .m file. Please name your file (first initial)(Last name)L03.m. For example, my file would be named jMearsL03.m. Start your file off with the command clear and please clearly label each problem with comments in your file.
Exercises:¶
- Create the following matrices in MATLAB©. It is convention to assume that unlisted elements in a matrix are 0. You may use whatever "intermediate" matrices you'd like, but DO NOT JUST MANUALLY ENTER EACH ELEMENT of the matrix.
$$
A1 = \left(\begin{matrix} 10 & &  \\ & 10 & \\ & & 10 \end{matrix}\right), \quad\quad B1 = \left(\begin{matrix} 1 & 4\\ 2 & 5 \\ 3 & 6\end{matrix}\right), \quad\quad C1 = \left(\begin{matrix}1 & 2 & 3 & 4 & 12 & 13 & 14\end{matrix}\right),\quad\quad D1 = \left(\begin{matrix} 1 & 2 & 2\\ 2 & 1 & 2 \\ 2 & 2 & 1\end{matrix}\right),\quad\quad E1 = \left(\begin{matrix} 1 & 4\\ 2 & 5 \\ 3 & 6 \\1 & \\  & 1 \end{matrix}\right).
$$
 
- Use the 
diag command to create the following matrices.
$$
A2 = \left(\begin{matrix} 1 & & \\ & 1 & \\ & & 1\end{matrix}\right),\quad\quad B2 = \left(\begin{matrix} 10 & & \\ & 12 & \\ & & 14\end{matrix}\right),\quad\quad C2 = \left(\begin{matrix} 9 & 1 & 1 \\ 1 & 10 & 1 \\ 1 & 1 & 11 \end{matrix}\right).
$$
 
- Use the 
diag command's ability to assign vectors to so-called "off-diagonals" to create the following matrices.
$$
A3 = \left(\begin{matrix} 1 & 1 & 0 \\ 1 & 2 & 2 \\ 0 & 2 & 3\end{matrix}\right),\quad\quad B3 = \left(\begin{matrix} -2 & 1 & 0 & \cdots & \cdots & 0 \\ 1 & -2 & 1 & \cdots & \cdots & 0 \\ 0 & 1 & -2 & 1 & \cdots & 0 \\ \vdots & \ddots & \ddots & \ddots & \ddots & \vdots \\ 0 & 0 &0 & 1 & -2 & 1 \\ 0 & 0 & \cdots & \cdots & 1 & -2 \end{matrix}\right)
$$