![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1550852/image.png)
Make Sequence Function go Diagonal
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ainars Cernavskis
am 19 Jul. 2021
Kommentiert: Rena Berman
am 27 Nov. 2023
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 Kommentare
Sam Chak
am 23 Nov. 2023
The original question may be beneficial for people who wish to learn how to create a diagonal matrix.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1550852/image.png)
Akzeptierte Antwort
Sameer Pujari
am 19 Jul. 2021
Just do this small change
n = input ('sequence_matrix_');
fibb=[1,3:n];
for i=3:n
fibb(i)=fibb(i-1)*3+(i)-2;
end
diag(fibb)
Weitere Antworten (1)
Walter Roberson
am 19 Jul. 2021
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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Time Series Objects finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!