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!