Make Sequence Function go Diagonal
古いコメントを表示
Hi ,how would i make this function go diagonal?,any help would be great
n = input ('sequence_matrix_');
fibb=[1,3:n];
for i=3:n
fibb(i)=fibb(i-1)*3+(i)-2;
end
fibb
2 件のコメント
Sam Chak
2023 年 11 月 23 日
The original question may be beneficial for people who wish to learn how to create a diagonal matrix.

Rena Berman
2023 年 11 月 27 日
(Answers Dev) Restored edit
採用された回答
その他の回答 (1 件)
Walter Roberson
2021 年 7 月 19 日
n = input ('sequence_matrix_');
fibb = diag([1,3:n]);
for i=3:n
fibb(i,i) = fibb(i-1,i-1)*3+(i)-2;
end
fibb
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!