A Creat a Matrix B using submatrices made up of elementary m
A) Creat a Matrix B using submatrices made up of elementary matrices: one, zeros and identity matrix of the special sizes
B) Show the diagonal of Matrix B in a row vector without the transpose
(C) Using Matlab. Create vectors C, C1, and C2 of length 4, 3, 2 respectively.
(D) Using Matlab. Create Matrix C use part (C) by putting d on the main diagonal, C1 on the first upper diagonal and C2 on the second lower diagonal.
Solution
submatrix1 = ones(3,2);
 submatrix2 = zeros(2,5);
 submatrix3 = eye(3);
 B = horzcat(submatrix1, submatrix3);
 B = vertcat(B, submatrix2)
 diag = [];
 for i=1:size(B,1)
     for j=1:size(B,2)
         if i==j
             diag(end+1) = B(i,j);
         end
     end
 end
 disp(diag);
 C = zeros(4,1);
 C1 = zeros(3,1);
 C2 = zeros(2,1);

