I'd like to create a matrix shown in the figure. It's a NC*(N+C) matrix. All N block matrixes on the left are C*C identity matrix, and all N block matrixes on the right are C*N matrixes. For the block matrixes on the right, the 1st matrix has the 1st column of 1 and the 2nd matrix has the 2nd column of 1 and so on until the nth matrix with the nth column of 1 and all other elements are 0.
For example ,if N=20 and C=30, then the matrix is 600*50. then all 20 left hand side identity matrixes are 30*30 and all 20 right hand side matrixes are 30*20 with the corresponding column are 1. how could I create this matrix by mata?
0 Response to Using mata to create matrix
Post a Comment