Matriz N^2,N^2
Show older comments
hello, I want to make this array of matrices where R and Id are NxN matrices. The array must be N2 x N2. Any help?

Answers (2)
Image Analyst
on 9 Dec 2021
0 votes
I'm sure there are fancier, more compact but cryptic ways using kron(), hankel(), toeplitz(), blkdiag() or some such functions, but did you just try a simple for loop?
1 Comment
Christian Hernández
on 9 Dec 2021
N=4;
R=toeplitz([4 -1 zeros(1,N-2)]);
Id=speye(N);
k=toeplitz([1,2, repmat(3,1,N-2) ]);
blocks={R,-Id,0*Id};
A1=cell2mat(blocks(k));
full(A1)
Categories
Find more on MATLAB 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!