Given an nxn matrix A, how do I produce a lower triangular matrix with ones on the diagonal?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Operating on Diagonal Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!