Question: Solve using MATLAB Write an m-file that first creates a row vector called r that goes by 2s from 2 until 20. Then create a
Solve using MATLAB
Write an m-file that first creates a row vector called r that goes by 2s from 2 until 20. Then create a 3x5 matrix, T, where each row has equally spaced elements with the first row starting at 2 and ending at 10, the second starting at 12 and ending at 20, and the last starting at 22 and ending at 30. Write additional lines in your script file that use indexing commands to accomplish the following:
(a) assign a vector a that has the 1st, 3rd, 5th, and 7th elements of r
(b) assign a 2x5 matrix b that has the first 5 elements of r in the first row and the last 5 elements of r in the second row
(c) assign a 4x2 matrix C that has the first column as the 2nd to 5th elements of r and the second column as the 9th to 6th elements of r
(d) assign a 2x4 matrix D that has the first 4 elements of T in the first row and the last 4 elements of T in the second row.
(e) assign a row vector e that consists of the 4th column of T followed by the 2nd row of T.
(f) assigns a 5x5 matrix F that has the first 3 columns of T (a 3x3 sub-matrix) in the bottom right corner and all other elements being zero.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
