how do I create the below Matrix?
古いコメントを表示
please see the attached image i need to create a tridiagonal nxn matrix using the diag function. i know how to make it this way but thats not what is required.
>> A=[2 -1 0 0 0;-1 2 -1 0 0;0 -1 2 -1 0;0 0 -1 2 -1; 0 0 0 -1 2]
A =
2 -1 0 0 0
-1 2 -1 0 0
0 -1 2 -1 0
0 0 -1 2 -1
0 0 0 -1 2
1 件のコメント
James Tursa
2015 年 3 月 24 日
"... not what is required."
Is this homework? Have you reviewed the doc on diag to see how to get values into the off-diagonals?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Testing Frameworks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!