How to create an n by n wilkinson matrix using diag

조회 수: 9 (최근 30일)
Colani Dlamini
Colani Dlamini 2019년 9월 16일
댓글: Alejandra Lizarazo 2020년 9월 20일
How to create an n by n wilkinson bidiagonal matrix
  댓글 수: 5
Walter Roberson
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.
Alejandra Lizarazo
Alejandra Lizarazo 2020년 9월 20일
I have the same problem, could you solve that?

댓글을 달려면 로그인하십시오.

채택된 답변

Bruno Luong
Bruno Luong 2019년 9월 19일
n = 10;
W = spdiags([n:-1:1; n*ones(1,n)]',[0 1],n,n);
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 9월 19일
I believe that this is a homework assignment that specifically requires diag() be used.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by