How to generate a normal matrix?
古いコメントを表示
How to generate the following matrix in MATLAB? where α is real number, and n is odd number.

採用された回答
その他の回答 (1 件)
Bjorn Gustavsson
2021 年 3 月 4 日
1 投票
Have a look at the help and documentation of the diag-function. This question indicates that you're very new to matlab, so you might get up to speed faster if you look through the matlab-onramp material. One of the main skills to learn is to browse efficiently through the help. You should also be able to use the lookfor function to find starting-points for your help-search.
HTH
3 件のコメント
Omar B.
2021 年 3 月 4 日
Bjorn Gustavsson
2021 年 3 月 4 日
Well this is just "2/3rds" of a tri-diagonal matrix, so then you should be set?
A = diag(alpha*ones(n,1),0) + diag(ones(n-1,1),-1);
I typically forgets if I need +1 or -1 for the sub/sup-diagonals and have to check - but checking is a good fraction of good programming practice...
Omar B.
2021 年 3 月 5 日
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!