How can i get the fibonacci sequence ?
Mostra commenti meno recenti
by using for-loops or while-loops
Risposte (3)
Image Analyst
il 17 Mar 2014
0 voti
Most likely John D'Errico has the best way for doing this. Look at his File Exchange submission and see how he does it. http://www.mathworks.com/matlabcentral/fileexchange/34766-the-fibonacci-sequence
Youssef Khmou
il 17 Mar 2014
hi, its easy to implement such function :
function y=fibo(x)
y(1)=1;
y(2)=1;
for n=3:x
y(n)=y(n-1)+y(n-2);
end
Sohila Wagdi
il 22 Set 2020
0 voti
function y=fibo(x) y(1)=1; y(2)=1; for n=3:x y(n)=y(n-1)+y(n-2); end
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!