Given an nxn matrix A, how do I produce a lower triangular matrix with ones on the diagonal?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Given an nxn matrix A, how do I produce a lower triangular matrix with ones on the diagonal?
I tried
A = rand(n,n);
L = tril(A,1) + diag(ones(1, size(A,1))) ;
but it isn't working.
0 commentaires
Réponses (1)
Voir également
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!