Suppose I have an m x n
matrix A .
Is there a way to create B
, a (n x m) x n
matrix whose "diagonal" is formed by A
's columns ?
Example:
A = [1 2;
3 4]
B = [1 0;
3 0;
0 2;
0 4]
A block diagonal matrix is therefore a block matrix in which the blocks off the diagonal are the zero matrices, and the diagonal matrices are square.
To reduce the matrix 'A' in a diagonal form, we have to find the model matrix 'P' and inverse of 'P,' multiplication of P-1AP will give you the diagonal matrix as shown in the image below. The next step would be to find out the characteristic polynomial of A.
No, every symmetric matrix and the diagonal matrix doesnot commute. Hence the matrices will not commute.
Here is a way:
A
to a cell array of its columns, using mat2cell
;blkdiag
.Code:
A = [1 2; 3 4]; %// example data
C = mat2cell(A, size(A,1), ones(1,size(A,2))); %// step 1
B = blkdiag(C{:}); %// step 2
This produces
B =
1 0
3 0
0 2
0 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With