Given an nxn matrix A, how do I produce a lower triangular matrix with ones on the diagonal?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!