How to generate matrix using MATLAB ?
Mostrar comentarios más antiguos
How to generate matrix of 24 * 96 order using MATLAB as shown in figure.

3 comentarios
Jan
el 14 de Feb. de 2014
The shown array is not a 24x96 matrix.
Jos (10584)
el 15 de Feb. de 2014
take care … your MS product activation failed … ;-)
Respuesta aceptada
Más respuestas (3)
Wayne King
el 14 de Feb. de 2014
Editada: Wayne King
el 14 de Feb. de 2014
I'm sure there are many different ways:
X = zeros(1,96);
X(1:4) = 1;
K = 0;
for nn = 1:24
Y(nn,:) = circshift(X,K,2);
K = K+4;
end
Assuming that each row of 96 elements has 4 1's and each row is a shifted version of the previous one.
1 comentario
Explorer
el 15 de Feb. de 2014
Roger Stafford
el 14 de Feb. de 2014
Here's another way:
m = 4; n = 24;
x = reshape(diff(floor((m*n+m*(0:m*n^2))/(m*n+1))),n,m*n);
1 comentario
Explorer
el 15 de Feb. de 2014
Jos (10584)
el 15 de Feb. de 2014
An easy way:
m = kron(eye(24),ones(1,4))
1 comentario
Explorer
el 15 de Feb. de 2014
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!