How can I create a matlab matrix below?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I've been wanting to construct a matlab matrix that is n by n. and looks like this. I've beeen trying to use diag but the function diag doesn't provide this. so m a bit confused. Please help!
0 件のコメント
採用された回答
Walter Roberson
2021 年 3 月 3 日
N = 6;
diag(-2*ones(1,N)) + diag(ones(1,N-1),-1) + diag(ones(1,N-1),1)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!