Creation of matrices (24,72) M1&M2 ?

Hello. I want to create matrices (24,72) that have the following forms:

 Accepted Answer

Stephen23
Stephen23 on 2 Feb 2016
Edited: Stephen23 on 3 Feb 2016
You can use blkdiag:
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

Thank you Stephen Cobeldick
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);

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!