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

9 visualizaciones (últimos 30 días)
ET-TAOUSSI mehdi
ET-TAOUSSI mehdi el 2 de Feb. de 2016
Comentada: Stephen23 el 3 de Feb. de 2016
Hello. I want to create matrices (24,72) that have the following forms:

Respuesta aceptada

Stephen23
Stephen23 el 2 de Feb. de 2016
Editada: Stephen23 el 3 de Feb. de 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 comentarios
ET-TAOUSSI mehdi
ET-TAOUSSI mehdi el 2 de Feb. de 2016
Thank you Stephen Cobeldick
Stephen23
Stephen23 el 3 de Feb. de 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);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by