Make Sequence Function go Diagonal
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Ainars Cernavskis
el 19 de Jul. de 2021
Comentada: Rena Berman
el 27 de Nov. de 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 comentarios
Sam Chak
el 23 de Nov. de 2023
The original question may be beneficial for people who wish to learn how to create a diagonal matrix.
Respuesta aceptada
Sameer Pujari
el 19 de Jul. de 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)
Más respuestas (1)
Walter Roberson
el 19 de Jul. de 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 comentarios
Ver también
Categorías
Más información sobre Time Series Objects en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!