Create a big matrix with submatrices The following matrix G

Create a big matrix with submatrices: The following matrix G is created by putting matrices A, B, and C from Exercise 1, on its diagonal and inserting 2 × 2 zeros matrices and 2 × 2 identity matrices in the appropriate position. Create the matrix using submatrices A, B, C, zeros and eye (that is, you are not allowed to enter the numbers explicitly).

A = [2,6,3,9] B = [1,2,3,4] C = [-5,5,5,3]

using matlab

G = [ 2 6 0 0 1 0

3 9 0 0 0 1

0 0 1 2 0 0

0 0 3 4 0 0

1 0 0 0 -5 5

0 1 0 0 5 3 ]

Solution

A = [2,6,3,9]; B = [1,2,3,4]; C = [-5,5,5,3];
G = zeros(6,6);
M1 = transpose(reshape(A,[2,2]));
M2 = transpose(reshape(B,[2,2]));
M3 = transpose(reshape(C,[2,2]));
G = blkdiag(M1,M2,M3);
G(5:6,1:2)=eye(2);
G(1:2,5:6)=eye(2)

Create a big matrix with submatrices: The following matrix G is created by putting matrices A, B, and C from Exercise 1, on its diagonal and inserting 2 × 2 zer

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site