How to create an n by n wilkinson matrix using diag
6 views (last 30 days)
Show older comments
Colani Dlamini
on 16 Sep 2019
Commented: Alejandra Lizarazo
on 20 Sep 2020
How to create an n by n wilkinson bidiagonal matrix
5 Comments
Walter Roberson
on 18 Sep 2019
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.
Accepted Answer
Bruno Luong
on 19 Sep 2019
n = 10;
W = spdiags([n:-1:1; n*ones(1,n)]',[0 1],n,n);
1 Comment
Walter Roberson
on 19 Sep 2019
I believe that this is a homework assignment that specifically requires diag() be used.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!