Effacer les filtres
Effacer les filtres

Is there any built-in function to make a matrix having non-zero entries in reverse diagonal only?

3 vues (au cours des 30 derniers jours)
I know the command eye(3) generates an identity matrix having ones in its principal diagonal but I want to make a matrix that has ones in its secondary diagonal. I have searched out but the diag() command also places the entries in principal diagonal or in other diagonals moving from left to right however, I want to place the entries from right to left.
a = eye(3)
b = diag(2,3,4)
The outputs of above commands are given as
a =
1 0 0
0 1 0
0 0 1
b =
2 0 0
0 3 0
0 0 4
However I want a matrix like this one
0 0 1
0 1 0
1 0 0

Réponse acceptée

madhan ravi
madhan ravi le 15 Avr 2019
Modifié(e) : madhan ravi le 15 Avr 2019

Plus de réponses (0)

Catégories

En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by