How to create a desired matrix using existing 2 matrices?

Let ‘A’ be a matrix of (N*(T-2)) rows and ((T-2)*(T-1))/2 columns and ‘B’ be a matrix of (N*(T-2)) rows and (T-2) columns. How to construct matrix ‘C’ using matrix ‘A’ and ‘B’? Where matrix ‘C’ is having (2N*(T-2)) rows and (((T-2)*(T-1)/2)+(T-2)).

2 Kommentare

Adam
Adam am 5 Okt. 2016
Bearbeitet: Adam am 5 Okt. 2016
There is no uniquely defined matrix satisfying that if you want the result matrix to have both rows and columns totalling the sum of the number of rows and columns of the 2 input matrices. Some portion of the matrix will be undefined also. It would help to give a real example.
For a given N, T the size of C equals to exactly the sum of sizes of A and B. You have to insert zeros for extra portion.
N = 10 ;
T = 20 ;
A = rand(N*(T-2),(T-2)*(T-1)/2) ;
B = rand(N*(T-2),(T-2)) ;
C = zeros(2*N*(T-2),(T-2)*(T-1)/2+(T-2)) ;
In the above change N, T and check the sizes. How you want to fill the extra gap?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Massimo Zanetti
Massimo Zanetti am 5 Okt. 2016
C= [A,B;A,B];

2 Kommentare

Sir, command [A,B;A,B] results as matrix 'D' which is mentioned in the attached file below but I want the matrix 'C'which is also mentioned in the attached file.

Melden Sie sich an, um zu kommentieren.

Kategorien

Tags

Gefragt:

am 5 Okt. 2016

Kommentiert:

am 5 Okt. 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by