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!