Create a matrix from some given matrices
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have this matrix to implement. Where user would define the value of dimensions ( p and N).
what would be the most efficient way to doing this in matlab.
0 Commenti
Risposte (2)
David Hill
il 23 Set 2019
As long as the size of matrices A,B,and C are the same, creating new matrix as listed above is as simple as the following.
newMatrix = [A,B,zeros(size(A));C,A,B;zeros(size(A)),C,A];
0 Commenti
Stephen23
il 23 Set 2019
>> p = 2;
>> N = 3;
>> A = randi(9,p,p)
A =
6 7
2 1
>> B = randi(9,p,p)
B =
3 1
1 8
>> C = randi(9,p,p)
C =
7 9
3 1
>> D = {zeros(p,p),C,A,B};
>> V = ones(1,N-2);
>> X = toeplitz([3,2,V],[3,4,V]);
>> M = cell2mat(D(X))
M =
6 7 3 1 0 0
2 1 1 8 0 0
7 9 6 7 3 1
3 1 2 1 1 8
0 0 7 9 6 7
0 0 3 1 2 1
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrices and Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!