Creation of matrices (24,72) M1&M2 ?
6 views (last 30 days)
Show older comments
Hello. I want to create matrices (24,72) that have the following forms:

0 Comments
Accepted Answer
Stephen23
on 2 Feb 2016
Edited: Stephen23
on 3 Feb 2016
C1 = repmat({[1,1,0]},1,24);
M1 = blkdiag(C1{:});
And the second is either:
M2 = circshift(M1,[0,1]);
or
C2 = repmat({[0,1,1]},1,24);
M2 = blkdiag(C2{:});
2 Comments
Stephen23
on 3 Feb 2016
Another simple method is to use eye, zeros and reshape:
M1 = reshape([eye(24);eye(24);zeros(24)],24,72);
M2 = reshape([zeros(24);eye(24);eye(24)],24,72);
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices 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!