Consider the following matrices 1 5 2 8 7 1 6 6 3 6 4 7 8 7

Consider the following matrices: 1 5 2 8 7 1 (6) 6 3 6 4 7 8 (7) and (8) 5 1 9 Note that the \"T\" in Eqtn. 8 denotes a transpose: n other words, c is actually a column vector. Enter Eqtns. 6, 7, and 8 into MATLAB as variables A b, and c, respectively, then programmatically perform these operations in MATLAB 1. Create a matrix d by copying the second row of matrix A. 2. Imagine a matrix defined as a 2 x 2 matrix of elements in the bottom left-hand corner of the matrix A. Create a matrix e by copying these elements from the matrix A 3. Take all of the columns in row 2 of matrix A multiply those elements element-by-element with the contents of the matrix c, and then store the result of these operations as a variable f 4. Copy matrix A into a new matrix g Allocate a 2 x 2 matrix h using the zeros command Now imagine a matrix defined as a 2 x 2 matrix of elements in the top right-hand corner of the matrix g; replace this subset of elements with the contents of h. 5. Calculate i, the minimum value of a of the variable elements of the A by first transforming matrix A nto a vector that contains all of the values of A. Then calculate j, the minimum of Athis time without making any changes to the dimensions of A. Hint: For the second approach, consider nesting one command inside of another command. Your answer should be the same for both approaches, so use that knowledge to check your work. 6. Calculate k, the number of elements in matrix b 7. Use the size command to find the size of the variable c. Store the number of rows as a variable called num rows and store the number of columns as a variable called num cols.

Solution

A=[1 5 2;8 7 1 ;6 3 6];
b=[4 7 8];
c=[5;1;9];
  

d=A((2),[1 2 3]); %2 row and 1 2 3 colum of A

e=A([2 3],[1 2 ]); %2 and 3 rows and 1 2 column

f=A((2),[1 2 3])*c;

g=A;

h = zeros(2);

g(1,2)=h(1,1);
g(1,3)=h(1,2);
g(2,2)=h(2,1);
g(2,3)=h(2,2);

k= numel(b); %%gives the no of elements of matrix b

[num_rows,num_cols] = size(c);


%g=h([1 2],[2]);

 Consider the following matrices: 1 5 2 8 7 1 (6) 6 3 6 4 7 8 (7) and (8) 5 1 9 Note that the \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site