Info

この質問は閉じられています。 編集または回答するには再度開いてください。

create function that displays fibonacci series

1 回表示 (過去 30 日間)
Rachel Dawn
Rachel Dawn 2018 年 2 月 14 日
閉鎖済み: Birdman 2018 年 2 月 14 日
So, I have four goals here: the user will input the first two numbers of fibonacci series, and the length of the series (n). Fourth goal: function will output 'n' numbers of the Fibonacci series (starting at the two numbers that the user entered).
I've been at this for two hours (youtube videos and all), yet all I've been able to come up with is this:
function FibLength = myFibonacci(n)
if n==0||n==1
FibLength= n;
else
FibLength= myFibonacci(n-2)+myFibonacci(n-1)
end
Which , by the way, just prints out the 'nth' number of the Fibonacci series. Can someone guide me here please?

回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by