How do I calculate the values of the fibonacci sequence using a while loop in matlab?

1 次查看(过去 30 天)
I am given the vector fib=[0,1]. I am told to create a new vector that continues the list of Fibonacci sequence values after the given vector using a while loop. The limit is 5702887. I am also given that there should be 26-39 elements in the new vector. My last step is to output the number of elements in the vector and their corresponding values. I am a beginner at matlab and am unfamiliar with while loops. Could someone please help me?
  1 个评论
Torsten
Torsten 2015-11-26
If you are not familiar with while-loops, try a for-loop together with an if-statement first. We will then help you to transform your code to include a while loop.
Best wishes
Torsten.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2015-11-26
You have also already had multiple copies of this questions closed as duplicates.
You need to stop re-posting your question and start using what you learned in the answers you have already been given. If there is something in those answers you do not understand, ask there. Do no keep reposting the same question.
When you continue to post the same question after having been given answers on the techniques to use, it makes it look like what you are asking is for someone to give you the solution to your homework.

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by