How to create an n by n wilkinson matrix using diag
6 ビュー (過去 30 日間)
古いコメントを表示
How to create an n by n wilkinson bidiagonal matrix
5 件のコメント
Walter Roberson
2019 年 9 月 18 日
It looks like for the bidiagonal form, that the main diagonal should be n:-1:1 and that the diagonal to the right of it should be all n .
You can construct bidiagonal matrices by using diag() to construct each of the diagonals, and adding the matrices together.
採用された回答
Bruno Luong
2019 年 9 月 19 日
n = 10;
W = spdiags([n:-1:1; n*ones(1,n)]',[0 1],n,n);
1 件のコメント
Walter Roberson
2019 年 9 月 19 日
I believe that this is a homework assignment that specifically requires diag() be used.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!