MATLAB Answers

0

How to create an n by n wilkinson matrix using diag

Asked by Colani Dlamini on 16 Sep 2019
Latest activity Commented on by Walter Roberson
on 19 Sep 2019
How to create an n by n wilkinson bidiagonal matrix

  4 Comments

Show 1 older comment
Yes, but the bidiagonal form not the tridiagonal form of wilkinson matrix.
I know nothing about wilkinson matrices but every reference I find only mention tridiagonal matrices.
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.

Sign in to comment.

Tags

1 Answer

Answer by Bruno Luong
on 19 Sep 2019
 Accepted Answer

n = 10;
W = spdiags([n:-1:1; n*ones(1,n)]',[0 1],n,n);

  1 Comment

I believe that this is a homework assignment that specifically requires diag() be used.

Sign in to comment.