How to create an n by n wilkinson matrix using diag

6 vues (au cours des 30 derniers jours)
Colani Dlamini
Colani Dlamini le 16 Sep 2019
How to create an n by n wilkinson bidiagonal matrix
  5 commentaires
Walter Roberson
Walter Roberson le 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.
Alejandra Lizarazo
Alejandra Lizarazo le 20 Sep 2020
I have the same problem, could you solve that?

Connectez-vous pour commenter.

Réponse acceptée

Bruno Luong
Bruno Luong le 19 Sep 2019
n = 10;
W = spdiags([n:-1:1; n*ones(1,n)]',[0 1],n,n);
  1 commentaire
Walter Roberson
Walter Roberson le 19 Sep 2019
I believe that this is a homework assignment that specifically requires diag() be used.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Octave dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by