How can i get the fibonacci sequence ?
3 ビュー (過去 30 日間)
古いコメントを表示
by using for-loops or while-loops
0 件のコメント
回答 (3 件)
Image Analyst
2014 年 3 月 17 日
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
0 件のコメント
Youssef Khmou
2014 年 3 月 17 日
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
0 件のコメント
Sohila Wagdi
2020 年 9 月 22 日
function y=fibo(x) y(1)=1; y(2)=1; for n=3:x y(n)=y(n-1)+y(n-2); end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!