Create a matrix from some given matrices
1 view (last 30 days)
Show older comments
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 Comments
Answers (2)
David Hill
on 23 Sep 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 Comments
Stephen23
on 23 Sep 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 Comments
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!