problem of matrix operations
Mostrar comentarios más antiguos
i have a n*n matrix. i want to obtain (row number-column number) matrix.for a 4*4 matrix result should be
[0 -1 -2 -3;
1 0 -1 -2;
2 1 0 -1;
3 2 1 0];
i want to do this for any (n*n) matrix.is there any method to do this.
Respuesta aceptada
Más respuestas (2)
Azzi Abdelmalek
el 30 de Sept. de 2013
a=rand(4) % Example
n=size(a,1)
bsxfun(@minus,repmat((1:n)',1,n),(1:n))
1 comentario
mahesh chathuranga
el 3 de Oct. de 2013
Andrei Bobrov
el 30 de Sept. de 2013
Editada: Andrei Bobrov
el 3 de Oct. de 2013
toeplitz(0:3,-(0:3))
1 comentario
mahesh chathuranga
el 3 de Oct. de 2013
Categorías
Más información sobre Resizing and Reshaping Matrices 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!